home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / DRI-archive / roche / DrLogo_Ref_Sec_6.txt < prev    next >
Text File  |  2009-12-11  |  197KB  |  8,504 lines

  1. DRLRM6.WS4      (= "Dr. Logo Reference Manual", Section 6)
  2. ----------
  3.  
  4. (Retyped by Emmanuel ROCHE. Posted to comp.os.cpm.amethyst by
  5. Roche on 1 Apr 2005.)
  6.  
  7.  
  8.  +------------------------------------------------------+
  9.  | ---> WARNING: Not proof-readed! <---                 |
  10.  |                                                      |
  11.  | MISSING explanation: PAL, SETPAL (which don't work?) |
  12.  +------------------------------------------------------+
  13.  
  14. ROCHE>  Since only the CP/M-86 version of "Dr. Logo for the  ACT
  15. Apricot  F1"  computer has been found, I have retyped  only  the
  16. documentation  of the primitives contained in this version,  not
  17. the  explanations  of all the primitives of the  original  copy-
  18. protected  Dr.  Logo, which can format floppy disks,  copy  full
  19. disks,  etc  (like computers with BASIC in ROM,  which  have  no
  20. separate Operating Systems).
  21.  
  22.  
  23. Section 6: References to primitives
  24. -----------------------------------
  25.  
  26. This section defines the Dr. Logo primitives. The description of
  27. each primitive is presented in the following form:
  28.  
  29.  
  30. Action
  31. ======
  32.  
  33. Quickly tells what the primitive does.
  34.  
  35.  
  36. Syntax
  37. ======
  38.  
  39. Shows  the  correct  way  to  enter  an  expression  using   the
  40. primitive.  If  you can use an abbreviation  for  the  primitive
  41. name, the abbreviation appears on the second line.
  42.  
  43. Do not enter a command that is identical to the syntax line! The
  44. syntax  line  usually contains symbols that Dr.  Logo  does  not
  45. recognize. By using these symbols, the syntax line can represent
  46. the  wide  variety of expressions that you can enter  using  the
  47. primitive.
  48.  
  49. The  syntax  line uses two kinds of symbols to show you  how  to
  50. enter  an  expression. Typographical symbols tell you  how  many
  51. times  you can enter an input. Input symbols tell what  kind  of
  52. object  the  primitive can accept as  input.  The  typographical
  53. symbols are
  54.  
  55.  
  56. ellipsis: (...)
  57. ---------------
  58.  
  59. Means that the primitive can accept a variable number of inputs;
  60. that  is to say, you can use parentheses to make  the  primitive
  61. accept more or fewer inputs than are ordinarily required.
  62.  
  63. If  the primitive name is preceded by a left parenthesis  ["("],
  64. the  primitive processes as many inputs as it finds  before  the
  65. closing  right  parenthesis  [")"]  without  complaint.  If   no
  66. expression follows the parenthesized expression on the line, you
  67. do not need to type the closing parenthesis.
  68.  
  69.  
  70. angle brackets: < >
  71. -------------------
  72.  
  73. Enclose optional inputs. (Inputs shown in angle brackets are not
  74. required.)
  75.  
  76.  
  77. "or" bar: |
  78. -----------
  79.  
  80. Separates  alternative  inputs.  Enter one  of  the  two  inputs
  81. separated  by  |. For example, name | name_list  means  you  can
  82. enter either a name or a list of names.
  83.  
  84.  
  85. The  following symbols represent the objects you can input to  a
  86. primitive:
  87.  
  88. object
  89. ------
  90.  
  91. Means  the primitive can accept any object as input: a  word,  a
  92. name, a number, a list, or an expression that outputs a word,  a
  93. name,  a  number,  or a list. You can also  use  a  variable  to
  94. represent any object input to a procedure.
  95.  
  96.  
  97. name
  98. ----
  99.  
  100. Represents a special word that identifies either a procedure,  a
  101. variable,  or  a "package" of procedures and variables.  When  a
  102. primitive  can accept only a certain kind of name as input,  one
  103. of the following symbols appears:
  104.  
  105.    - varname    a variable name
  106.    - procname   a procedure name
  107.    - pkgname    a package name
  108.    - d:         a drive name
  109.    - fname     a file name that can begin with an optional drive
  110. name to specify a drive other than the default
  111.    -  prop      a property name; the first member of a  property
  112. pair in a property list
  113.  
  114.  
  115. list
  116. ----
  117.  
  118. Means a list is required as input. A literal list is a series of
  119. Logo  words, numbers, or lists enclosed in square brackets  ("["
  120. and  "]"). You can construct a "not literal" list that  contains
  121. the value of a variable by using the list or sentence primitive.
  122. Some of the special kinds of lists are:
  123.  
  124.   - instr_list  contains instructions to be executed
  125.   - coord_list contains a pair of numbers that define a location
  126. on the screen
  127.   - name_list   contains names of variables, procedures,  and/or
  128. packages
  129.  
  130.  
  131. numbers: n, _n
  132. --------------
  133.  
  134. Represent input numbers. n represents any number. You can  enter
  135. an  expression that outputs a number anywhere n appears.  _n  is
  136. appended  to  a  descriptive  term  when  a  special  number  is
  137. required;  for  example,  degrees_n means the  input  number  is
  138. interpreted as a number of degrees.
  139.  
  140.  
  141. infix primitive inputs: a, b
  142. ----------------------------
  143.  
  144. Represent  inputs  to an infix primitive,  where  the  primitive
  145. identifier is a symbol embedded between the inputs. a and b  can
  146. represent both numbers and objects. In arithmetic expressions, a
  147. and  b  represent numbers, as in 1 + 2 and 12 /  6.  In  logical
  148. expressions,  a and b can represent any object, as in [a b c]  =
  149. [a b c], 3 > 1, or :son = "greg.
  150.  
  151.  
  152. pred_exp
  153. --------
  154.  
  155. Represents  a  predicate expression, an  expression  that,  when
  156. evaluated, outputs either TRUE or FALSE.
  157.  
  158.  
  159. Explanation
  160. ===========
  161.  
  162. Describes  the  action  or result of an  expression  in  detail.
  163. Discusses  optional inputs, punctuation, and how  the  primitive
  164. works with other primitives, if appropriate.
  165.  
  166. In these discussions, "you" means you, the Dr. Logo  programmer.
  167. "Your user" refers to a person who runs your Dr. Logo  procedure
  168. and  might type something at the keyboard to interact with  your
  169. procedure.
  170.  
  171.  
  172. Examples
  173. ========
  174.  
  175. Shows   expressions   and  procedures   that   demonstrate   the
  176. capabilities  of the primitive. This section sometimes  includes
  177. discussions of the example expressions and procedures.
  178.  
  179. Most  of the examples show you exactly what to type to  get  the
  180. response  shown  in the text. However, some  examples,  such  as
  181. those for erasing, must assume there is already something in the
  182. workspace to erase. A brief description of assumptions about the
  183. workspace  precedes  these examples. You might not  be  able  to
  184. reproduce  these  examples exactly, but, by studying  them,  you
  185. will learn the capabilities of the primitives they demonstrate.
  186.  
  187. The  examples assume that you are using a graphic screen,  which
  188. has  a line length of 40 characters. When you have typed  a  40-
  189. character line, Dr. Logo enters an exclamation point ("!") which
  190. indicates that your text continues on the next line. You do  not
  191. type the exclamation point yourself.
  192.  
  193.  
  194.  *         (see product)
  195.  +         (see sum)
  196.  .contents (see contents)
  197.  .deposit  (see deposit)
  198.  .examine  (see examine)
  199.  .in       (see in)
  200.  .out      (see out)
  201.  .replace  (see replace)
  202.  .reptail  (see reptail)
  203.  .setseg   (see setseg)
  204.  \  "Quoting character" = Ctrl-Q
  205.  
  206.  
  207. abs
  208. ---
  209.  
  210. Action:
  211. Outputs the absolute value of the input number.
  212.  
  213. Syntax:
  214. abs n
  215.  
  216. Explanation:
  217. abs outputs the absolute value of the input number. You can  use
  218. abs  to  show the distance from the turtle's  position  to  home
  219. excluding  any  + or - sign that indicates its location  in  the
  220. coordinate  scale. For example, if you move the turtle  back  50
  221. steps from home, its position if [0 -50]. However, its  distance
  222. from  home is the absolute value of -50 (sometimes shown  as  |-
  223. 50|), or 50 turtle steps.
  224.  
  225. Examples:
  226. ?cs
  227. ?bk 50
  228. ?pos
  229. [0 -50]
  230. ?abs last pos
  231. 50
  232.  
  233. See  Colorplate 1 (back 50 (abs Primitive)) at the beginning  of
  234. this section.
  235.  
  236.  
  237. allopen
  238. -------
  239.  
  240. Action:
  241. Outputs a list of all data files currently open.
  242.  
  243. Syntax:
  244. allopen
  245.  
  246. Explanation:
  247. Outputs a list of all data files currently open.
  248.  
  249. Examples:
  250. ?allopen
  251.  
  252.  
  253. and
  254. ---
  255.  
  256. Action:
  257. Outputs TRUE if all input predicate expressions output TRUE.
  258.  
  259. Syntax:
  260. and pred_exp pred_exp (...)
  261.  
  262. Explanation:
  263. and outputs TRUE if all input predicate expressions output TRUE.
  264. Otherwise, and outputs FALSE.
  265.  
  266. Without punctuation, and requires and accepts two input objects.
  267. and  can  accept more or fewer inputs when you enclose  the  and
  268. expression in parentheses ["(" and ")"]. If no other expressions
  269. follow  the and expression on the line, you do not need to  type
  270. the closing right parenthesis [")"].
  271.  
  272. You  can use an and expression to test different conditions,  or
  273. build your own predicate procedure.
  274.  
  275. Examples:
  276. ?and "TRUE "TRUE
  277. TRUE
  278. ?and "TRUE "FALSE
  279. FALSE
  280. ?and "FALSE "FALSE
  281. FALSE
  282. ?and (3<4) (7>3)
  283. TRUE
  284. ?and (3=4) (7>3)
  285. FALSE
  286. ?(and (3<4) (7>3) (9=9) (6<5))
  287. FALSE
  288. ?to tub.right? :temperature
  289. >if and (:temperature > 88) (:temperatur!
  290. e < 102)
  291. >     [pr [Just Right!]]
  292. >     [pr [Not Right.]]
  293. >end
  294. tub.right? defined
  295. ?tub.right? 90
  296. Just Right!
  297. ?to decimalp :object
  298. >output and (numberp :object) (pointp :o!
  299. bject)
  300. >end
  301. decimalp defined
  302. ?to pointp :object
  303. >if emptyp :object [output "FALSE]
  304. >if (first :object) = ". [output "TRUE]
  305. >output pointp butfirst :object
  306. >end
  307. pointp defined
  308. ?decimalp 1995
  309. FALSE
  310. ?decimalp 19.95
  311. TRUE
  312. ?decimalp [nineteen.ninety-five]
  313. FALSE
  314.  
  315.  
  316. arctan
  317. ------
  318.  
  319. Action:
  320. Outputs the arc tangent of the input number.
  321.  
  322. Syntax:
  323. arctan n
  324.  
  325. Explanation:
  326. arctan  outputs in degrees the angle whose tangent is the  input
  327. number.
  328.  
  329. Examples:
  330. ?arctan 0
  331. 0
  332. ?arctan 1
  333. 45
  334. ?arctan 10
  335. 84.2894068625003
  336. ?arctan 100
  337. 89.4270613023165
  338. ?to plot.arctan
  339. >make "val -pi
  340. >make "inc pi / 37.5
  341. >make "x -150
  342. >setx 150
  343. >setx :x
  344. >plot :val
  345. >end
  346. plot.arctan defined
  347. ?to plot :val
  348. >if :x > 150 [stop]
  349. >fd arctan :val
  350. >sety 0
  351. >setx :x + 4
  352. >make "x :x + 4
  353. >make "val :val + :inc
  354. >plot :val
  355. >end
  356. plot defined
  357. ?plot.arctan
  358.  
  359. See Colorplate 2. plot.arctan (arctan Primitive)
  360.  
  361.  
  362. ascii
  363. -----
  364.  
  365. Action:
  366. Outputs  the  ASCII value of the first character  in  the  input
  367. word.
  368.  
  369. Syntax:
  370. ascii word
  371.  
  372. Explanation:
  373. ascii outputs an integer between 0 and 255 that is the  American
  374. Standard  representation  for the first character in  the  input
  375. word.  The input word must contain at least one  character.  The
  376. first character can be a letter, number, or special character.
  377.  
  378. The  American Standard Code for Information Interchange  (ASCII)
  379. is  a  standard  code for  representing  numbers,  letters,  and
  380. symbols.  The IBM Personal Computer has many  unique  characters
  381. that are also represented by ASCII codes. The "Dr. Logo  Command
  382. Summary" contains a list of characters and their ASCII values.
  383.  
  384. Examples:
  385. ?ascii "g
  386. 103
  387. ?ascii "good
  388. 103
  389. ?ascii "2
  390. 50
  391. ?to encode :word
  392. >if emptyp :word [output "]
  393. >output word secret first :word encode !
  394. butfirst :word
  395. >end
  396. encode defined
  397. ?to make secret :character
  398. >make "secretcode 5 + ascii :character
  399. >if :secretcode > ascii "z
  400. >   [make "secretcode :secretcode - 26]
  401. >output char :secretcode
  402. >end
  403. secret defined
  404. ?to decode :word
  405. >if emptyp :word [output "]
  406. >output word crack first :word decode b!
  407. utfirst :word
  408. >end
  409. decode defined
  410. ?to crack :character
  411. >make "crackedcode (ascii :character= -!
  412. 5
  413. >if :crackedcode < ascii "a
  414. >   [make "crackedcode :crackedcode + 2!
  415. 6]
  416. >output char :crackedcode
  417. >end
  418. crack defined
  419. ?make "password encode "plastics
  420. ?:password
  421. uqfxynhx
  422. ?decode :password
  423. plastics
  424.  
  425.  
  426. back bk
  427. -------
  428.  
  429. Action:
  430. Moves  the  turtle  the input number of steps  in  the  opposite
  431. direction of its heading.
  432.  
  433. Syntax:
  434. back distance_n
  435. bk distance_n
  436.  
  437. Explanation:
  438. back  moves  the  turtle the specified number of  steps  in  the
  439. opposite direction of its current heading. The turtle's  heading
  440. and  pen do not change. If the turtle's pen is down, the  turtle
  441. leaves  a  trace of its path. On the IBM  Personal  Computer,  a
  442. turtle step is equivalent to one dot (pixel).
  443.  
  444. back  can help you write a procedure that leaves the  turtle  in
  445. the  same  position when the procedure ends as it was  when  the
  446. procedure started. Leaving the turtle in the same position makes
  447. it easy to call the procedure from another procedure.
  448.  
  449. Examples:
  450. ?cs
  451. ?back 50
  452.  
  453. See Colorplace 1.  back 50 (back Primitive)
  454.  
  455. ?cs
  456. ?to flag
  457. >forward 50
  458. >repeat 3 [right 120 fd 25]
  459. >back 50
  460. >end
  461. flag defined
  462. ?to wheel
  463. >repeat 12 [flag left 30]
  464. >end
  465. wheel defined
  466. ?flag
  467. ?wheel
  468.  
  469. See Colorplate 3, flag (back Primitive), and Colorplate 4, wheel
  470. (back Primitive).
  471.  
  472.  
  473. bury
  474. ----
  475.  
  476. Action:
  477. Hides the specified package from subsequent workspace management
  478. commands.
  479.  
  480. Syntax:
  481. bury pkgname | pkgname_list
  482.  
  483. Explanation:
  484. bury  hides  the specified package or  packages  from  workspace
  485. management  commands.  bury works by setting the  bury  property
  486. (.BUR)  in  the package's property list to TRUE.  The  following
  487. primitives check property lists before taking action, and ignore
  488. any buried procedures or variables:
  489.  
  490.         edall   erall   glist   pops    save
  491.         edns    erns    poall   pots
  492.         edps    erps    pons    pps
  493.  
  494. All  of  these primitives optionally accept a  package  name  as
  495. input.  If no package name is specified, these commands  address
  496. the entire contents of the worspace, except for buried packages.
  497. All  other  procedures access buried  procedures  and  variables
  498. normally.  For  example,  a procedure  that  receives  a  buried
  499. variable  name as input accesses the buried  variable  normally.
  500. potl and popkg display the names of buried procedures.  proclist
  501. includes all defined procedure names, buried or unburied, in the
  502. list it outputs.
  503.  
  504. Examples:
  505. These  examples  assume  you have the following  items  in  your
  506. workspace: two packages named figures and titles, two  variables
  507. named big and small, and four procedures named prauthor, prdate,
  508. square, and triangle.
  509.  
  510. ?popkg
  511. figures
  512.   "big (VAL)
  513.   "small (VAL)
  514.   to square
  515.   to triangle
  516. titles
  517.   to prauthor
  518.   to prdate
  519. ?bury "titles
  520. ?popkg
  521. figures
  522.   "big (VAL)
  523.   "small (VAL)
  524.   to square
  525.   to triangle
  526. titles is buried
  527.   to prauthor
  528.   to prdate
  529. ?pots
  530. to square
  531. to triangle
  532.  
  533.  
  534. butfirst bf
  535. -----------
  536.  
  537. Action:
  538. Outputs all but the first element in the input object.
  539.  
  540. Syntax:
  541. butfirst object
  542. bf object
  543.  
  544. Explanation:
  545. butforst outputs all but the first element of the input  object.
  546. If  the  input  object  is  a  list,  butfirst  outputs  a  list
  547. containing  every  element of the input list, except  the  first
  548. element. If the input object is a word, butfirst outputs a  word
  549. containing all but the first character of the input word. If the
  550. input object is an empty word or empty list, butfirst returns an
  551. error.
  552.  
  553. Examples:
  554. ?butfirst "abalone
  555. balone
  556. ?butfirst [semi sweet chocolate]
  557. [sweet chocolate]
  558. ?bf [[chocolate chip] [walnut date] [oa!
  559. tmeal raisin]]
  560. [[walnut date] [oatmeal raisin]]
  561. ?bf "y
  562. ?bf [brownie]
  563. []
  564. ?to vanish :object
  565. >if emptyp :object [stop]
  566. >print :object
  567. >vanish butfirst :object
  568. >end
  569. vanish defined
  570. ?vanish "abracadabra
  571. abracadabra
  572. bracadabra
  573. racadabra
  574. acadabra
  575. cadabra
  576. adabra
  577. dabra
  578. abra
  579. bra
  580. ra
  581. a
  582.  
  583.  
  584. butlast bl
  585. ----------
  586.  
  587. Action:
  588. Outputs all but the last element in the input object.
  589.  
  590. Syntax:
  591. butlast object
  592. bl object
  593.  
  594. Explanation:
  595. butlast outputs all but the last element of the input object. If
  596. the  input object is a list, butlast outputs a  list  containing
  597. every element of the input list, except the last element. If the
  598. input  object is a word, butlast outputs a word  containing  all
  599. but the last character of the input word. If the input object is
  600. an empty word or empty list, butlast returns and error.
  601.  
  602. Examples:
  603. ?butlast "drawn
  604. draw
  605. ?butlast [fudge walnut]
  606. [fudge]
  607. ?bl "y
  608. ?bl [snickerdoodle]
  609. []
  610. ?to gobble :object
  611. >if emptyp :object [stop]
  612. >print :object
  613. >gobble butlast :object
  614. >end
  615. gobble defined
  616. ?gobble "turkey
  617. turkey
  618. turke
  619. turk
  620. tur
  621. tu
  622. t
  623.  
  624.  
  625. buttonp         (= BUTTON Predicate)
  626. -------
  627.  
  628. Action:
  629. Outputs TRUE if the button on the specified paddle (joystick) is
  630. down.
  631.  
  632. Syntax:
  633. buttonp paddle_n
  634.  
  635. Explanation:
  636. buttonp  outputs TRUE if the button on the specified  paddle  or
  637. joystick  is  down. Dr. Logo can accept input from  two  paddle.
  638. Each  paddle can have two buttons. You use buttonp to  determine
  639. whether or not a button in pressed. If you do not have a  paddle
  640. or joystick, buttonp always output FALSE.
  641.  
  642. buttonp  requires  an input number to identify one of  the  four
  643. paddle buttons. Numbers in the range 0 to 3 identify the  paddle
  644. buttons as follows:
  645.  
  646.         0 identifies button 1, paddle 1
  647.         1 identifies button 2, paddle 1
  648.  
  649.         2 identifies button 1, paddle 2
  650.         3 identifies button 2, paddle 2
  651.  
  652. Examples:
  653. draw allows the user to guide the turtle with the joystick.  The
  654. two buttonp commands allow the user to stop drawing or erase the
  655. drawing  by  pressing  the paddle buttons. draw  is  more  fully
  656. described under paddle.
  657.  
  658. ?to draw
  659. >repeat 10000
  660. >  [make "xin paddle 0
  661. >  make "yin paddle 1
  662. >  make "xin int ((:xin * (300 / 190)) !
  663. - 150)
  664. >  make "yin int ((:yin * (-200 / 144))!
  665.  + 90)
  666. >  setheading towards list :xin :yin
  667. >  fd [amount * 0.1]
  668. >  if buttonp 0 [stop]
  669. >  if buttonp 1 [stop]
  670. >end
  671. draw defined
  672. ?to amount
  673. >op int sqrt
  674. >  ((abs :xin) * (abs :xin) +
  675. >  ((abs :yin) * (abs :yin)))
  676. >end
  677. amount defined
  678. ?draw
  679.  
  680.  
  681. bye
  682. ---
  683.  
  684. Action:
  685. Exits Dr. Logo and returns to the operating system.
  686.  
  687. Syntax:
  688. bye
  689.  
  690. Explanation:
  691. Exits  current session of Dr. Logo and returns to the  operating
  692. system.  You can enter bye to Dr. Logo's ? or ! prompt;  bye  is
  693. not valid when you are in the editor or while you are  executing
  694. a procedure. When you enter bye, any procedures or variables you
  695. have not saved on disk are lost.
  696.  
  697. Examples:
  698. ?bye
  699.  
  700.  
  701. catch
  702. -----
  703.  
  704. Action:
  705. Traps  errors  and  special conditions  that  occur  during  the
  706. execution of the input instruction list.
  707.  
  708. Syntax:
  709. catch name instr_list
  710.  
  711. Explanation:
  712. catch  works  with  the throw primitive to  let  your  procedure
  713. handle  special  conditions.  For example, by  using  catch  and
  714. throw, your procedure can display a special message if your user
  715. types something incorrectly. catch and throw can also  intercept
  716. an error that would normally make Dr. Logo display a message  on
  717. the screen.
  718.  
  719. catch  and throw each require a name as input. To pair  a  catch
  720. expression with a throw expression, you must give the catch  and
  721. throw expressions the same input name.
  722.  
  723. When  a catch command is executed, Dr. Logo simply executes  the
  724. input  instruction  list. Execution proceeds  normally  until  a
  725. throw  expression, usually in a called procedure,  identifies  a
  726. special condition. Then, Dr. Logo returns to the procedure  that
  727. contains  the catch command identified by the thrown  name.  Dr.
  728. Logo then executes the line that follows the catch command.
  729.  
  730. There  are  two special names you can input to catch:  TRUE  and
  731. error.  TRUE matches any throw name, so catch "TRUE catches  any
  732. throw.  Dr. Logo automatically executes a throw  "error  command
  733. when  an  error  occurs. Therefore, a  catch  "error  expression
  734. catches  any error that occurs. Without catch "error,  an  error
  735. makes  Dr.  Logo print a message on the screen,  terminate  your
  736. procedure's  execution, and return to toplevel (the  ?  prompt).
  737. The  description  of the error primitive tells how to  find  out
  738. what the error was.
  739.  
  740. Examples:
  741. The  coil procedure asks the user to enter  increasingly  larger
  742. numbers  as the turtle draws a coil on the screen. If  the  user
  743. types  a  number that is not bigger than the last  one  entered,
  744. coil reminds the user what to type and continues working.
  745.  
  746. ?to coil
  747. >pr [Enter a small number.]
  748. >make "previous 0
  749. >fd grownumber
  750. >rt 30
  751. >trap
  752. >end
  753. coil defined
  754. ?to grownumber
  755. >make "growth first readlist
  756. >if :growth < :previous [throw "notbigg!
  757. er]
  758. >make "previous :growth
  759. >output :growth
  760. >end
  761. grownumber defined
  762. ?to trap
  763. >catch "notbigger [drawcoil]
  764. >(pr [Enter a number bigger than] :prev!
  765. ious)
  766. >trap
  767. >end
  768. trap defined
  769. ?to drawcoil
  770. >pr [Enter a bigger number.]
  771. >fd grownumber
  772. >rt 30
  773. >drawcoil
  774. >end
  775. drawcoil defined
  776.  
  777. The  throw  "notbigger instruction in the  grownumber  procedure
  778. always  returns  Dr.  Logo  to the trap  procedure.  If  a  stop
  779. instruction  had  been  used instead of throw,  Dr.  Logo  would
  780. return  to the procedure that called grownumber, which might  be
  781. either coil or drawcoil.
  782.  
  783. The following procedures allow the user to type commands just as
  784. if  typing  to the Dr. Logo interpreter. However,  if  the  user
  785. enters a command incorrectly, the mymessage procedure traps  the
  786. normal Dr. Logo error message and prints a custom message.
  787.  
  788. ?to mymessage
  789. >catch "error [interpret]
  790. >(pr "Oops! first butfirst error [! ! !!
  791. ])
  792. >pr [What do you want to do about that?!
  793. ]
  794. >run readlist
  795. >mymessage
  796. >end
  797. mymessage defined
  798. ?to interpret
  799. >pr [What next, boss?]
  800. >run readlist
  801. >interpret
  802. >end
  803. interpret defined
  804.  
  805.  
  806. changef         (= CHANGE Filename)
  807. -------
  808.  
  809. Action:
  810. Changes the name of a file in the disk directory.
  811.  
  812. Syntax:
  813. changef <d:>new_fname old_fname
  814.  
  815. Explanation:
  816. changef  changes the name of a file in a disk  directory.  Enter
  817. the  name  you  want to give the file, followed  by  the  file's
  818. current  name. You can put a disk specifier in front of the  old
  819. name if the file is not on the default disk drive.
  820.  
  821. Examples:
  822. The  following examples assume you have three Dr. Logo files  on
  823. the disk in your default drive: piglatin, fly, and shapes.
  824.  
  825. ?dir
  826. [PIGLATIN.LOG FLY.LOG SHAPES.LOG]
  827. ?changef "pigl "piglatin
  828. ?dir
  829. [PIGL.LOG FLY.LOG SHAPES.LOG]
  830.  
  831.  
  832. char
  833. ----
  834.  
  835. Action:
  836. Outputs the character whose ASCII value is the input number.
  837.  
  838. Syntax:
  839. char n
  840.  
  841. Explanation:
  842. char  outputs  the  character whose ASCII  value  is  the  input
  843. number. char requires an integer between 0 and 255 as input.
  844.  
  845. The  American Standard Code for Information Interchange  (ASCII)
  846. is  a  standard  code for  representing  numbers,  letters,  and
  847. symbols.  The IBM Personal Computer has many  unique  characters
  848. that are also represented by ASCII codes. The "Dr. Logo  Command
  849. Summary" contains a list of characters and their ASCII codes.
  850.  
  851. Examples:
  852. ?char 103
  853. g
  854. ?char 50
  855. 2
  856. ?repeat 20 [(type random 10 char 9)]
  857. 3   0   6   1   3   5   1   8   0   1  !
  858. 8   6   7   1   1   9   3   8   4   5  !
  859. ?to encode :word
  860. >if emptyp :word [output "]
  861. >output word secret first :word encode !
  862. butfirst :word
  863. >end
  864. encode defined
  865. ?to secret :character
  866. >make "secretcode (ascii :character) + !
  867. 5
  868. >if :secretcode > (ascii "z)
  869. >   [make "secretcode :secretcode - 26]
  870. >output char :secretcode
  871. >end
  872. secret defined
  873. ?to decode :word
  874. >if emptyp :word [output "]
  875. >output word crack first :word decode b!
  876. utfirst :word
  877. >end
  878. decode defined
  879. ?to crack :character
  880. >make "crackedcode (ascii :character) -!
  881. 5
  882. >if :crackedcode < (ascii "a)
  883. >   [make "crackedcode :crackedcode + 2!
  884. 6]
  885. >output char :crackedcode
  886. >end
  887. crack defined
  888. ?make "password encode "elephant
  889. ?:password
  890. jqjumfsy
  891. ?decode :password
  892. elephant
  893.  
  894.  
  895. clean
  896. -----
  897.  
  898. Action:
  899. Erases the graphic screen without affecting the turtle.
  900.  
  901. Syntax:
  902. clean
  903.  
  904. Explanation:
  905. clean  erases  everything the turtle has drawn  on  the  graphic
  906. screen,  but  leaves  the  turtle in  its  current  heading  and
  907. location.
  908.  
  909. Examples:
  910. ?to trispi :side
  911. >if :side > 80 [stop]
  912. >fd :side rt 120
  913. >trispi (:side + 3)
  914. >end
  915. trispi defined
  916. ?trispi 5
  917. ?clean
  918.  
  919. See  Colorplate 5, trispi (clean Primitive), and  Colorplate  6,
  920. clean (clean Primitive).
  921.  
  922.  
  923. clearscreen cs
  924. --------------
  925.  
  926. Action:
  927. Erases  the  graphics  screen and puts the turtle  in  the  home
  928. position.
  929.  
  930.  
  931. Syntax:
  932. clearscreen
  933. cs
  934.  
  935. Explanation:
  936. clearscreen  erases  everything  the turtle  has  drawn  on  the
  937. graphic  screen and returns the turtle "home" to location [0  0]
  938. heading 0 (North).
  939.  
  940. Examples:
  941. ?to trispi :side
  942. >if :side > 80 [stop]
  943. >fd :side rt 120
  944. >trispi (:side + 3)
  945. >end
  946. trispi defined
  947. ?trispi 5
  948. ?clearscreen
  949.  
  950. See   Colorplate  7,  trispi  5  (clearscreen  Primitive),   and
  951. Colorplate 8, clearscreen (clearscreen Primitive).
  952.  
  953.  
  954. cleartext ct
  955. ------------
  956.  
  957. Action:
  958. Erases  all  text  in the window  that  currently  contains  the
  959. cursor,  then positions the cursor in the upper left  corner  of
  960. the window.
  961.  
  962. Syntax:
  963. cleartext
  964. ct
  965.  
  966. Explanation:
  967. cleartext  erases  all text displayed in  the  window  currently
  968. containing  the cursor, then positions the cursor at  the  upper
  969. left corner of the window. For example, if your entire screen is
  970. devoted to text, cleartext erases the entire screen, and  places
  971. the cursor in the upper left corner.
  972.  
  973. If  you  are using the two debugging windows,  cleartext  erases
  974. only the text in the window that currently contains the  cursor.
  975. To  cleartext in the program output window, your procedure  must
  976. contain and execute a cleartext command.
  977.  
  978. Examples:
  979. This  example  assumes  you have the  following  items  in  your
  980. worspace:  two packages named figures and titles, two  variables
  981. named big and small, and four procedures named prauthor, prdate,
  982. square, and triangle.
  983.  
  984. ?popkg
  985. figures
  986.   "big (VAL)
  987.   "small (VAL)
  988.   to square
  989.   to triangle
  990. titles
  991.   to prauthor
  992.   to prdate
  993. ?cleartext
  994.  
  995.  
  996. close
  997. -----
  998.  
  999. Action:
  1000. Closes the named data file.
  1001.  
  1002. Syntax:
  1003. close fname
  1004.  
  1005. Explanation:
  1006. Closes the named data file.
  1007.  
  1008. Examples:
  1009. ?close "Ketchum
  1010.  
  1011.  
  1012. closeall
  1013. --------
  1014.  
  1015. Action:
  1016. Closes all the data files currently open.
  1017.  
  1018. Syntax:
  1019. closeall
  1020.  
  1021. Explanation:
  1022. Closes all the data files currently open.
  1023.  
  1024. Examples:
  1025. ?closeall
  1026.  
  1027.  
  1028. co
  1029. --
  1030.  
  1031. Action:
  1032. Ends  a pause that is caused by a pause expression or  a  Ctrl-Z
  1033. keystroke.
  1034.  
  1035. Syntax:
  1036. co <object>
  1037.  
  1038. Explanation:
  1039. co  continues  the  execution of a procedure  interrupted  by  a
  1040. pause. During a pause, you can interact with the interpreter  to
  1041. debug  your procedure. Enter co when you have finished with  the
  1042. interpreter and want to continue the execution of the procedure.
  1043.  
  1044. There are three ways to cause a pause during the execution of  a
  1045. procedure:
  1046.  
  1047.      1) the execution of a pause expression within the procedure
  1048.      2) a Ctrl-Z keystroke
  1049.      3) any error, if the system variable ERRACT is TRUE.
  1050.  
  1051. When  a pause interrupts the execution of a procedure, Dr.  Logo
  1052. displays  a  "Pausing..."  message and shows  the  name  of  the
  1053. interrupted procedure before the interpreter's ? prompt. If  you
  1054. have  enabled  the  debug windows, the  pause  prompt  and  your
  1055. interactions with the interpreter appear in the DEBUG window. No
  1056. matter  which way you begin a pause, you must use co to  end  it
  1057. and continue your procedure's execution.
  1058.  
  1059. Give  co  an  input  only if you  have  interrupted  a  reachar,
  1060. readlist, or readquote with a Ctrl-Z. When you give co an input,
  1061. it  becomes the output of the pause expression. Unless you  have
  1062. interrupted an rc, rl, or rq expression, Dr. Logo will not  know
  1063. what to do your your input.
  1064.  
  1065. Examples:
  1066. ?to boxspi :side
  1067. >if and :side > 80 :side < 90 [pause]
  1068. >fd :side rt 90
  1069. >boxspi (:side + 5)
  1070. >end
  1071. boxspi defined
  1072. ?boxspi 5
  1073. Ctrl-Z
  1074. Pausing... in boxspi: fd
  1075. boxspi ?:side
  1076. 60
  1077. boxspi ?co
  1078. Pausing... in boxspi: [if and :side > 8!
  1079. 0 :side <  90 !
  1080. [pause]]
  1081. boxspi ?:side
  1082. 85
  1083. boxspi ?co
  1084.  
  1085. See Colorplate 9.  boxspi/co (co Primitive)
  1086.  
  1087.  
  1088.  .contents
  1089.  ---------
  1090.  
  1091. Action:
  1092. Displays the contents of the Dr. Logo symbol space.
  1093.  
  1094. Syntax:
  1095.  .contents
  1096.  
  1097. Explanation:
  1098. Displays the contents of the Dr. Logo symbol space.
  1099.  
  1100. Examples:
  1101. ?.contents
  1102. [babla snip blablabla]
  1103.  
  1104.  
  1105. copydef
  1106. -------
  1107.  
  1108. Action:
  1109. Makes a copy of a procedure definition, and gives it a new name.
  1110.  
  1111. Syntax:
  1112. copydef new_procname old_procname
  1113.  
  1114. Explanation:
  1115. copydef  makes a copy of a procedure definition, and gives it  a
  1116. new  name.  copydef creates a new procedure by making  an  exact
  1117. copy  of an existing procedure definition, and giving it  a  new
  1118. title line. The new procedure becomes a part of your  workspace,
  1119. and can be referenced, edited, and saved on disk.
  1120.  
  1121. You  cannot associate a second name with a Dr.  Logo  primitive,
  1122. unless  you  have made the system variable REDEFP TRUE.  If  the
  1123. old_procname  is  a primitive, the new_procname  takes  all  the
  1124. characteristics  of  a primitive; it cannot be  printed  out  or
  1125. edited.
  1126.  
  1127. Examples:
  1128. ?to box :side
  1129. >repeat 4 [fd :side rt 90]
  1130. >end
  1131. box defined
  1132. ?copydef "square "box
  1133. ?po "square
  1134. to square :side
  1135. repeat 4 [fd :side rt 90]
  1136. end
  1137.  
  1138.  
  1139. copyoff
  1140. -------
  1141.  
  1142. Action:
  1143. Stops echoing text at the printer.
  1144.  
  1145. Syntax:
  1146. copyoff
  1147.  
  1148. Explanation:
  1149. copyoff stops the echoing of text at the printer. If you have  a
  1150. printer, you can start printer echo with copyon.
  1151.  
  1152. Examples:
  1153. These examples assume you have three files named pigl, fly,  and
  1154. shapes on the disk in the default drive.
  1155.  
  1156. ?copyon
  1157. ?dir             \
  1158. [PIGL FLY SHAPES] > This is echoed at printer.
  1159. ?copyoff         /
  1160. ?dir
  1161. [PIGL FLY SHAPES]
  1162.  
  1163.  
  1164. copyon
  1165. ------
  1166.  
  1167. Action:
  1168. Starts echoing text at the printer.
  1169.  
  1170. Syntax:
  1171. copyon
  1172.  
  1173. Explanation:
  1174. copyon  starts  echoing text at the printer, if  you  have  one.
  1175. After  copyon, everything Dr. Logo displays on your text  screen
  1176. is  also printed at the printer. You can stop printer echo  with
  1177. copyoff.
  1178.  
  1179. Examples:
  1180. The  following exampes assume you have three files  named  pigl,
  1181. fly, and shapes on the disk in your default drive.
  1182.  
  1183. ?copyon
  1184. ?dir             \
  1185. [PIGL FLY SHAPES] > This is echoed at printer.
  1186. ?copyoff         /
  1187. ?dir
  1188. [PIGL FLY SHAPES]
  1189.  
  1190.  
  1191. cos
  1192. ---
  1193.  
  1194. Action:
  1195. Outputs the cosine of the input number of degrees.
  1196.  
  1197. Syntax:
  1198. cos degrees_n
  1199.  
  1200. Explanation:
  1201. cos  outputs  the trigonometric cosine of the  input  number  of
  1202. degrees. cos outputs a decimal number between 0 and 1.
  1203.  
  1204. Examples:
  1205. ?cos 0
  1206. 1
  1207. ?to plot.cosine
  1208. >setpc 2
  1209. >make "val 0
  1210. >make "x -150
  1211. >make "inc (300 / 60)
  1212. >setx 150 setx -150
  1213. >pu setpos list :x 90 pd
  1214. >setpc 1
  1215. >plot :val
  1216. >end
  1217. plot.cosine defined
  1218. ?to plot :val
  1219. >if :x > 150 [stop]
  1220. >make "y (90 * (cos :val))  ; 90 makes p!
  1221. lot visible
  1222. >setheading towards list :x :y
  1223. >setpos list :x :y
  1224. >make "x :x + :inc
  1225. >make "val :val + 6
  1226. >plot :val
  1227. >end
  1228. plot defined
  1229. ?plot.cosine
  1230.  
  1231. See Colorplate 10. plot.cosine (cos Primitive)
  1232.  
  1233.  
  1234. count
  1235. -----
  1236.  
  1237. Action:
  1238. Outputs the number of elements in the input object.
  1239.  
  1240. Syntax:
  1241. count object
  1242.  
  1243. Explanation:
  1244. count outputs the number of elements in the input object,  which
  1245. can  be  a word, number, or list. To count the items in  a  list
  1246. within a list, use an item expression as input to count.
  1247.  
  1248. Examples:
  1249. ?count "chocolate
  1250. 9
  1251. ?count [chocolate]
  1252. 1
  1253. ?count [vanilla strawberry [mocha unswe!
  1254. etened milk german]]
  1255. 3
  1256. ?count item 3 [vanilla strawberry [moch!
  1257. a unsweetened milk german]]
  1258. 4
  1259.  
  1260.  
  1261. cursor
  1262. ------
  1263.  
  1264. Action:
  1265. Outputs a list that contains the column and line numbers of  the
  1266. cursor's position within the text window.
  1267.  
  1268. Syntax:
  1269. cursor
  1270.  
  1271. Explanation:
  1272. cursor  outputs a coordinate list that contains the  column  and
  1273. line  numbers of the cursor's position within the  text  window.
  1274. The first element of the list is the column number; the  second,
  1275. the line number. The line number ranges from 0 to 24. The column
  1276. number ranges from 0 to 79.
  1277.  
  1278. cursor  is  window-relative;  that is to  say,  it  outputs  the
  1279. cursor's position in the current window. When you are using  the
  1280. two debugging windows, a cursor expression returns the  location
  1281. of the cursor in the program output window.
  1282.  
  1283. Examples:
  1284. ?ct
  1285. ?cursor
  1286. [0 1]
  1287. ?(type  [The current cursor position is\!
  1288. ] show cursor
  1289. The current cursor position is [32 23]
  1290. ?pr se [The current cursor position is:!
  1291. ] cursor
  1292. The current cursor position is: 0 24
  1293.  
  1294.  
  1295. defaultd        (= DEFAULT Drive name)
  1296. --------
  1297.  
  1298. Action:
  1299. Outputs the name of the current default drive.
  1300.  
  1301. Syntax:
  1302. defaultd
  1303.  
  1304. Explanation:
  1305. defaultd outputs the name of the current default drive. Dr. Logo
  1306. looks in the directory of the disk in the default drive when you
  1307. do  not  specify a drive name in a disk command  such  as  save,
  1308. load, erasefile, changef, or dir.
  1309.  
  1310. Examples:
  1311. ?defaultd
  1312. A:
  1313. ?to saved
  1314. >make "disk.name defaultd
  1315. >end
  1316. saved defined
  1317. ?to restored
  1318. >setd :disk.name
  1319. >end
  1320. restored defined
  1321. ?saved
  1322. ?setd b:
  1323. ?defaultd
  1324. B:
  1325. ?restored
  1326. ?defaultd
  1327. A:
  1328.  
  1329.  
  1330. define
  1331. ------
  1332.  
  1333. Action:
  1334. Makes the input definition list the definition of the  specified
  1335. procedure name.
  1336.  
  1337. Syntax:
  1338. define procname defin_list
  1339.  
  1340. Explanation:
  1341. define  allows you to write a procedure that can in turn  define
  1342. other  procedures.  A  define  expression  defines  a  procedure
  1343. without using an editor, to, or end.
  1344.  
  1345. define  requires two inputs: a name and a definition list.  Note
  1346. that  the name you input to define cannot be the name of  a  Dr.
  1347. Logo primitive, unless REDEFP is TRUE.
  1348.  
  1349. A  definition  list  is a special kind of list  with  a  special
  1350. format.  The first element of the input list must be a  list  of
  1351. names  for  inputs  to the procedure. Do not  put  colons  (":")
  1352. before  names  in this list! If the procedure is to  require  no
  1353. inputs,  the  first element in define's input list  must  be  an
  1354. empty list. define uses the input name and the first element  of
  1355. the definition list to compose the title line of the procedure.
  1356.  
  1357. Each  remaining  element of define's input list must be  a  list
  1358. containing one line of the procedure definition. Do not put  end
  1359. in this list; end is not a part of a procedure's definition.
  1360.  
  1361. The  text  primitive  also uses this format when  it  outputs  a
  1362. definition list. In fact, you can use a text expression to input
  1363. a definition list to define.
  1364.  
  1365. Examples:
  1366. ?define "say.hello [[] [pr [Hello world!]]
  1367. ?po "say.hello
  1368. to say.hello
  1369. pr [Hello world!]
  1370. end
  1371. ?to learn
  1372. >make "definition [[]]
  1373. >pr [Enter expressions you would like s!
  1374. aved in a procedure.]
  1375. >pr [Enter erase to delete your last in!
  1376. struction.]
  1377. >readlines
  1378. >pr [Type y to define procedure, any ot!
  1379. her key to abandon.]
  1380. >test rc = "y
  1381. >ift [type [Name for procedure?]
  1382. >     make "title first readlist
  1383. >     define :title :definition
  1384. >end
  1385. learn defined
  1386. ?to readlines
  1387. >make "newline readlist
  1388. >if :newline = [end] [stop]
  1389. >if :newline = [erase] [delete]
  1390. >   [run :newline
  1391. >   make "definition lput :newline :def!
  1392. inition]
  1393. >readlines
  1394. >end
  1395. readlines defined
  1396. ?to delete
  1397. >pr se "Deleting last :definition
  1398. >make "definition butlast :definition
  1399. >end
  1400. delete defined
  1401. ?learn
  1402. Enter expressions you would like saved !
  1403. in a procedure.
  1404. Enter erase to delete your last instruc!
  1405. tion.
  1406. cs
  1407. erase
  1408. Deleting cs
  1409. setpc 1
  1410. fd 40 rt 90
  1411. setpc 2
  1412. repeat 36 [fd 5 lt 10]
  1413. lt 90 setpc 1 bk 40
  1414. pr "balloon!
  1415. balloon!
  1416. end
  1417. Type y to define procedure, any other k!
  1418. ey to abandon. y
  1419. Name for procedure?
  1420. balloon
  1421. ?balloon
  1422. balloon!
  1423.  
  1424. See Colorplate 11. balloon (define procedure)
  1425.  
  1426.  
  1427. definedp        (= DEFINED Predicate)
  1428. --------
  1429.  
  1430. Action:
  1431. Outputs TRUE if the input name identifies a defined procedure.
  1432.  
  1433. Syntax:
  1434. definedp object
  1435.  
  1436. Explanation:
  1437. definedp  outputs TRUE if the input name identifies a  procedure
  1438. currently  defined in the workspace. definedp returns  FALSE  if
  1439. the input name identifies a primitive name, a variable name,  or
  1440. anything but a defined procedure name.
  1441.  
  1442. Examples:
  1443. ?to balloon
  1444. >setpc 1
  1445. >fd 40 rt 90
  1446. >setpc 2
  1447. >repeat 36 [fd 5 lt 10]
  1448. >lt 90 setpc 1 bk 40
  1449. >pr "balloon!
  1450. >end
  1451. balloon defined
  1452. ?definedp "balloon
  1453. TRUE
  1454. ?definedp "definedp
  1455. FALSE
  1456.  
  1457.  
  1458. degrees
  1459. -------
  1460.  
  1461. Action:
  1462. Outputs the number of degrees in the input number of radians.
  1463.  
  1464. Syntax:
  1465. degrees radian_n
  1466.  
  1467. Explanation:
  1468. degrees  outputs  the number of degrees in the input  number  of
  1469. radians, where degrees = radians * (180 / pi).
  1470.  
  1471. Examples:
  1472. ?degrees 1
  1473. 57.2957795130823
  1474. ?degrees 2
  1475. 114.591559026165
  1476. ?degrees 3
  1477. 171.887338539247
  1478. ?to degrees.cycle :vals
  1479. >if emptyp :vals [stop]
  1480. >(pr [There are] degrees (run first :va!
  1481. ls) [degrees in] first :vals "radians.
  1482. >make "vals bf :vals
  1483. >degrees.cycle :vals
  1484. >end
  1485. degrees.cycle defined
  1486. ?make "vals [[pi] [(pi / 2)] [(pi /4)]!
  1487. [(pi / 8)]]
  1488. ?degrees.cycle :vals
  1489. There are 180 degrees in pi radians.
  1490. There are 90 degrees in (pi / 2) radian!
  1491. s.
  1492. There are 45 degrees in (pi / 4) radian!
  1493. s.
  1494. There are 22.5 degrees in (pi / 8) radi!
  1495. ans.
  1496.  
  1497.  
  1498.  .deposit
  1499.  --------
  1500.  
  1501. Action:
  1502. Puts a number into a memory location.
  1503.  
  1504. Syntax:
  1505.  .deposit n n
  1506.  
  1507. Explanation:
  1508. Puts the second input number into the memory location  specified
  1509. by  the  first input number. This location is  relative  to  the
  1510. absolute location established by .SETSEG. THIS PRIMITIVE  SHOULD
  1511. BE USED WITH CAUTION!
  1512.  
  1513. Examples:
  1514. ?.deposit 22
  1515.  
  1516. dir
  1517. ---
  1518.  
  1519. Action:
  1520. Outputs  a  list of the Dr. Logo file names on  the  default  or
  1521. specified disk.
  1522.  
  1523. Syntax:
  1524. dir <d:>
  1525.  
  1526. Explanation:
  1527. dir  outputs  a list of Dr. Logo file names on  the  default  or
  1528. specified disk. If you do not specify a disk drive, dir looks in
  1529. the directory of the default disk.
  1530.  
  1531. dir  accepts an ambiguous file name as input. An ambiguous  file
  1532. name  can  refer  to more than one file because  it  contains  a
  1533. wildcard  character and gives Dr. Logo a pattern to  match.  Dr.
  1534. Logo can then display the file names that match the pattern.
  1535.  
  1536. The  wildcard character is a question mark ("?"). When the  last
  1537. character  in  your  input file name is  a  question  mark,  dir
  1538. displays  the  file names that begin with  the  characters  that
  1539. precede the question mark.
  1540.  
  1541. The list dir outputs contains the names of only those files that
  1542. are  identified  by the LOG file type in the  disk's  directory.
  1543. save  automatically  gives  the file type LOG to  the  files  it
  1544. stores on disk.
  1545.  
  1546. Examples:
  1547. These examples assume you have three files named shapes,  plaid,
  1548. and  piglatin on the disk in your default drive, and  two  files
  1549. named coil and fly on the disk in drive B:.
  1550.  
  1551. ?dir
  1552. [SHAPES.LOG PLAID.LOG PIGLATIN.LOG]
  1553. ?dir "b:
  1554. [COIL.LOG FLY.LOG]
  1555. ?dir "p
  1556. [PLAID.LOG PIGLATIN.LOG]
  1557.  
  1558.  
  1559. dirpic
  1560. ------
  1561.  
  1562. Action:
  1563. Outputs  a list of the Dr. Logo picture files on the default  or
  1564. specified disk.
  1565.  
  1566. Syntax:
  1567. dirpic <d:>
  1568.  
  1569. Explanation:
  1570. dirpic  outputs a list of Dr. Logo picture files on the  default
  1571. or  specified disk. If you do not specify a disk  drive,  dirpic
  1572. looks in the directory of the default disk.
  1573.  
  1574. dirpic  accepts  an  ambiguous picture  filename  as  input.  An
  1575. ambiguous  picture filename can refer to more than  one  picture
  1576. file because it contains a wildcard character and gives Dr. Logo
  1577. a  pattern  to  match. Dr. Logo can  then  display  the  picture
  1578. filenames that match the pattern.
  1579.  
  1580. The  wildcard character is a question mark ("?"). When the  last
  1581. character  in  your input picture filename is a  question  mark,
  1582. dirpic  displays  the  picture filenames  that  begin  with  the
  1583. characters that precede the question mark.
  1584.  
  1585. The list dirpic outputs contains the names of only those picture
  1586. files  that  are identified by the PIC file type in  the  disk's
  1587. directory. savepic automatically gives the picture filetype  PIC
  1588. to the files it stores on disk.
  1589.  
  1590. Examples:
  1591. These examples assume you have three picture files named shapes,
  1592. plaid.
  1593.  
  1594. ?dirpic
  1595. [SHAPES.PIC PLAID.PIC PIGLATIN.PIC]
  1596.  
  1597.  
  1598. dot
  1599. ---
  1600.  
  1601. Action:
  1602. Plots  a dot at the position specified by the  input  coordinate
  1603. list.
  1604.  
  1605. Syntax:
  1606. dot coord_list
  1607.  
  1608. Explanation:
  1609. dot  plots a dot at the position specified by the input  graphic
  1610. screen coordinate list. The turtle is not affected in any way.
  1611.  
  1612. Examples:
  1613. ?dot [50 50]
  1614. ?to snow
  1615. >make "x random 150 * (first shuffle [1!
  1616.  -1])
  1617. >make "y random 100 * (first shuffle [1!
  1618.  -1])
  1619. >dot list :x :y
  1620. >snow
  1621. >end
  1622. snow defined
  1623. ?snow
  1624.  
  1625. See Colorplate 12. snow (dot Primitive)
  1626.  
  1627.  
  1628. dotc    (= DOT Color)
  1629. ----
  1630.  
  1631. Action:
  1632. Outputs the color number of a given dot.
  1633.  
  1634. Syntax:
  1635. dotc coord_list
  1636.  
  1637. Explanation:
  1638. Outputs  the  color  number  of  the  dot  at  the   coordinates
  1639. specified, or -1 if the location is not on the graphic viewport.
  1640.  
  1641. Examples:
  1642. ?dotc [50 10]
  1643. 2
  1644.  
  1645.  
  1646. edall           (= EDit ALL)
  1647. -----
  1648.  
  1649. Action:
  1650. Loads  all  the  variables and procedures in  the  workspace  or
  1651. specified package(s) into the screen editor's buffer, and enters
  1652. the screen editor.
  1653.  
  1654. Syntax:
  1655. edall <pkgname | pkgname_list>
  1656.  
  1657. Explanation:
  1658. With  or without an input, edall loads variables and  procedures
  1659. into  the screen editor's buffer, and enters the screen  editor.
  1660. edall  without an input loads all procedures and variables  from
  1661. Dr.  Logo's workspace into the screen editor's buffer. If  there
  1662. is nothing in the workspace, the screen editor displays an empty
  1663. buffer into which you can type either procedures or variables.
  1664.  
  1665. You  can  input  a package name or a list of  package  names  to
  1666. specify  a  group  of procedures and variables  to  edit.  edall
  1667. accepts only defined package names as input.
  1668.  
  1669. Within  the screen editor, you can use line editing  and  screen
  1670. editing  control  character commands to move  the  cursor,  make
  1671. changes  to  text,  and  exit the  screen  editor.  The  control
  1672. character   commands  are  described  in  Section  3,   "Editing
  1673. Commands",  and summarized in Appendix B, "Dr. Logo control  and
  1674. escape character commands".
  1675.  
  1676. Examples:
  1677. These examples assume you have two packages named draw.pack  and
  1678. move.pack in your workspace.
  1679.  
  1680. ?edall
  1681.  
  1682. edall  loads  all  the variables and procedures  in  Dr.  Logo's
  1683. workspace into the screen editor's buffer.
  1684.  
  1685. ?edall "draw.pack
  1686. edall  loads  all the variables and procedures  in  the  package
  1687. draw.pack into the screen editor's buffer.
  1688.  
  1689. ?edall [draw.pack move.pack]
  1690.  
  1691. edall  loads  all the variables and procedures in  the  packages
  1692. draw.pack and move.pack into the screen editor's buffer.
  1693.  
  1694.  
  1695. edf     (= EDit File)
  1696. ---
  1697.  
  1698. Action:
  1699. Loads a disk file into the text editor.
  1700.  
  1701. Syntax:
  1702. edf fname
  1703.  
  1704. Explanation:
  1705. Loads the specified disk file into the text editor's buffer,  or
  1706. creates  a  new file and enters the text editor  with  an  empty
  1707. buffer.
  1708.  
  1709. Examples:
  1710. ?edf "startup
  1711.  
  1712.  
  1713. edit ed
  1714. -------
  1715.  
  1716. Action:
  1717. Loads  the  specified procedure(s) and/or variable(s)  into  the
  1718. screen editor's buffer, and enters the screen editor.
  1719.  
  1720. Syntax:
  1721. edit <name | name_list>
  1722. ed <name | name_list>
  1723.  
  1724. Explanation:
  1725. An  edit  command  enters  the  screen  editor.  edit  can  load
  1726. procedures, variables, or both into the screen editor's  buffer.
  1727. Input  a procedure or variable name, or a list of procedure  and
  1728. variable names to specify what you want to edit.
  1729.  
  1730. edit is "smart" and assumes certain things about your objectives
  1731. for an editing session. First, it knows that you frequently  use
  1732. the screen editor to correct errors in procedures. So, when  the
  1733. execution  of  a procedure ends with an error  message  and  you
  1734. immediately enter an edit command without specifying a procedure
  1735. name, edit automatically loads the erroneous procedure into  the
  1736. screen editor, and positions the cursor at the line in which the
  1737. error occurred.
  1738.  
  1739. If  no error has occurred, edit without an input procedure  name
  1740. displays  an empty screen editor buffer. When you start to  edit
  1741. an empty buffer, your display is completely blank. You can  type
  1742. variable and procedure definitions into the empty buffer.
  1743.  
  1744. edit's  second assumption is that, when you are defining  a  new
  1745. procedure,  you need title and ending lines. When you  input  an
  1746. undefined procedure name in an edit command, edit creates  title
  1747. and ending lines in the screen editor's buffer.
  1748.  
  1749. Within  the screen editor, you can use line editing  and  screen
  1750. editing  control  character commands to move  the  cursor,  make
  1751. changes  to  text,  and  exit the  screen  editor.  The  control
  1752. character   commands  are  described  in  Section  3,   "Editing
  1753. Commands",  and summarized in Appendix B, "Dr. Logo control  and
  1754. escape character commands".
  1755.  
  1756. Examples:
  1757. The  following  examples assume that you have the  following  in
  1758. your  workspace: a variable named password and  four  procedures
  1759. named square, vanish, encode, and secret.
  1760.  
  1761. I don't know how to repaet in square: !
  1762. repaet 4 [fd 25 lt 90]
  1763. ?ed
  1764.  
  1765. edit automatically loads square into the screen editor's  buffer
  1766. and positions the cursor at the misspelling repaet.
  1767.  
  1768. ?edit "vanish
  1769.  
  1770. edit moads the procedure vanish into the screen editor's  buffer
  1771. and positions the cursor at the end of the title line.
  1772.  
  1773. ?ed [encode secret password
  1774.  
  1775. ed  loads  the  encode and secret procedures  and  the  variable
  1776. password  into  the  screen editor's buffer  and  positions  the
  1777. cursor after encode's title line.
  1778.  
  1779. ?ed "newidea
  1780.  
  1781. ed with an undefined procedure name automatically creates  title
  1782. and end lines in the screen editor's buffer.
  1783.  
  1784.  
  1785. edns    (= EDit NameS)
  1786. ----
  1787.  
  1788. Action:
  1789. Loads all the variables in the workspace or specified package(s)
  1790. into the screen editor's buffer, and enters the screen editor.
  1791.  
  1792. Syntax:
  1793. edns <pkgname | pkgname_list>
  1794.  
  1795. Explanation:
  1796. With  or without an input, edns loads variables into the  screen
  1797. editor's  buffer, and enters the screen editor. edns without  an
  1798. input  loads  all variables from Dr. Logo's workspace  into  the
  1799. screen  editor's buffer. If there is nothing in  the  workspace,
  1800. the  screen editor displays an empty buffer into which  you  can
  1801. type variable and procedure definitions.
  1802.  
  1803. You  can  input  a package name or a list of  package  names  to
  1804. specify a group of variables to edit. edns accepts only  defined
  1805. package names as input.
  1806.  
  1807. Within  the screen editor, you can use line editing  and  screen
  1808. editing  control  character commands to move  the  cursor,  make
  1809. changes  to  text,  and  exit the  screen  editor.  The  control
  1810. character   commands  are  described  in  Section  3,   "Editing
  1811. Commands",  and summarized in Appendix B, "Dr. Logo control  and
  1812. escape character commands".
  1813.  
  1814. Examples:
  1815. The  following examples assume that you have two packages  named
  1816. draw.pack and move.pack in your workspace.
  1817.  
  1818. ?edns
  1819.  
  1820. edns  loads all the variables in Dr. Logo's workspace  into  the
  1821. screen editor's buffer.
  1822.  
  1823. ?edns "draw.pack
  1824.  
  1825. edns  loads all the variables in the package draw.pack into  the
  1826. screen editor's buffer.
  1827.  
  1828. ?edns [draw.pack move.pack]
  1829.  
  1830. edns  loads  all  the variables in the  packages  draw.pack  and
  1831. move.pack into the screen editor's buffer.
  1832.  
  1833.  
  1834. edps    (= EDit ProcedureS)
  1835. ----
  1836.  
  1837. Action:
  1838. Loads   all  the  procedures  in  the  workspace  or   specified
  1839. package(s)  into  the  screen editor's buffer,  and  enters  the
  1840. screen editor.
  1841.  
  1842. Syntax:
  1843. edps <pkgname | pkgname_list>
  1844.  
  1845. Explanation:
  1846. With or without an input, edps loads procedures into the  screen
  1847. editor's  buffer, and enters the screen editor. edps without  an
  1848. input  loads all procedures from Dr. Logo's workspace  into  the
  1849. screen  editor's buffer. If there is nothing in  the  workspace,
  1850. the  screen editor displays an empty buffer into which  you  can
  1851. type either procedures or variables.
  1852.  
  1853. You  can  input  a package name or a list of  package  names  to
  1854. specify a group of procedures to edit. edps accepts only defined
  1855. package names as input.
  1856.  
  1857. Within  the screen editor, you can use line editing  and  screen
  1858. editing  control  character commands to move  the  cursor,  make
  1859. changes  to  text,  and  exit the  screen  editor.  The  control
  1860. character   commands  are  described  in  Section  3,   "Editing
  1861. Commands",  and summarized in Appendix B, "Dr. Logo control  and
  1862. escape character commands".
  1863.  
  1864. Examples:
  1865. The  following examples assume that you have two packages  named
  1866. draw.pack and move.pack in your workspace.
  1867.  
  1868. ?edps
  1869.  
  1870. edps  loads all the procedures in Dr. Logo's workspace into  the
  1871. screen editor's buffer.
  1872.  
  1873. ?edps "draw.pack
  1874.  
  1875. edps loads all the procedures in the package draw.pack into  the
  1876. screen editor's buffer.
  1877.  
  1878. ?edps [draw.pack move.pack]
  1879.  
  1880. edps  loads  all the procedures in the  packages  draw.pack  and
  1881. move.pack into the screen editor's buffer.
  1882.  
  1883.  
  1884. eform   (= E FORMat)
  1885. -----
  1886.  
  1887. Action:
  1888. Outputs a number in scientific notation.
  1889.  
  1890. Syntax:
  1891. eform n1 n2
  1892.  
  1893. Explanation:
  1894. Outputs n1 in scientific notation, using n2 digits. n2 must be a
  1895. positive, real number from 1 through 15.
  1896.  
  1897. Examples:
  1898. ?eform 1.2 1
  1899.  1.E+00
  1900.  
  1901.  
  1902. emptyp  (= EMPTY Predicate)
  1903. ------
  1904.  
  1905. Action:
  1906. Outputs  TRUE if the input object is an empty word or  an  empty
  1907. list.
  1908.  
  1909. Syntax:
  1910. emptyp object
  1911.  
  1912. Explanation:
  1913. An emptyp expression returns TRUE only if the input object is an
  1914. empty word or empty list. Use emptyp as the predicate expression
  1915. in an if command to determine if all elements of an object input
  1916. to the procedure have been processed.
  1917.  
  1918. Examples:
  1919. ?to nest.circles :sizes
  1920. >if emptyp :sizes [stop]
  1921. >repeat 36 [fd first :sizes lt 10]
  1922. >nest.circles bf :sizes
  1923. >end
  1924. nest.circles defined
  1925. ?make "sizes [1 2 3 4 5 6 7 8]
  1926. ?nest.circles :sizes
  1927.  
  1928. See Colorplate 13. nest.circles (emptyp Primitive)
  1929.  
  1930.  
  1931. end
  1932. ---
  1933.  
  1934. Action:
  1935. Indicates the end of a procedure definition.
  1936.  
  1937. Syntax:
  1938. end
  1939.  
  1940. Explanation:
  1941. end  is  a  special word that signals the  end  of  a  procedure
  1942. definition.  When you are using "to" to define a procedure,  you
  1943. must put "end" by itself as the last line of the procedure.
  1944.  
  1945. end signals to the procedure editor (the > prompt) that you have
  1946. finished   defining  a  procedure,  and  returns  you   to   the
  1947. interpreter's ? prompt. The screen editor automatically  inserts
  1948. "end"  if you press Ctrl-C and exit without entering "end".  Dr.
  1949. Logo also adds an end line to a procedure defined with a  define
  1950. expression.
  1951.  
  1952. end  is not part of a procedure's definition list, and is not  a
  1953. primitive. You can use "end" as a procedure or variable name  if
  1954. you are confident that the name will not cause undue confusion.
  1955.  
  1956. Examples:
  1957. ?to pent
  1958. >repeat 5 [fd 25 lt 72]
  1959. >end
  1960. pent defined
  1961.  
  1962. end signals the procedure editor that you have finished defining
  1963. a procedure, and returns you to the interpreter's ? prompt.
  1964.  
  1965. ?define "pent [[] [repeat 5 [fd 25 lt 72]
  1966. ?po "pent
  1967. to pent
  1968. repeat 5 [fd 25 lt 72]
  1969. end
  1970.  
  1971. The  define  expression automatically adds an end  line  to  the
  1972. procedure definition.
  1973.  
  1974.  
  1975. equalp  (= EQUAL Predicate)
  1976. ------
  1977.  
  1978. Action:
  1979. Outputs  TRUE if the input objects are equal numbers,  identical
  1980. words, or identical lists.
  1981.  
  1982. Syntax:
  1983. equalp object object
  1984.  
  1985. Explanation:
  1986. equalp outputs TRUE only if the input objects are equal numbers,
  1987. identical  words, or identical lists; otherwise, equalp  outputs
  1988. FALSE.
  1989.  
  1990. Examples:
  1991. ?equalp " []
  1992. FALSE
  1993. ?equalp "leaf first [leaf stem flower]
  1994. TRUE
  1995. ?equalp 72 (360 / 5)
  1996. TRUE
  1997. ?equalp [1 2 3] [2 3 4]
  1998. FALSE
  1999.  
  2000.  
  2001. erall   (= ERase ALL)
  2002. -----
  2003.  
  2004. Action:
  2005. Erases  all the procedures and variables from the  workspace  or
  2006. specified package(s).
  2007.  
  2008. Syntax:
  2009. erall <pkgname | pkgname_list>
  2010.  
  2011. Explanation:
  2012. erall  erases the definitions of procedues and variables.  erall
  2013. without  an input name erases the definitions of all  procedures
  2014. and  variables  from  Dr.  Logo's  workspace,  except  for   any
  2015. procedures  and variables in buried packages. erall  without  an
  2016. input  name  also  erases  the package  names  of  any  unburied
  2017. packages.
  2018.  
  2019. You can give erall a package name or a list of package names  to
  2020. specify a group of procedures and variables to be erased.  erall
  2021. can  accept a buried package name as input; with  this  request,
  2022. erall can erase a buried package.
  2023.  
  2024. erall  works by removing property pairs from the property  lists
  2025. associated  with  package,  variable, and  procedure  names.  It
  2026. removes  the .PKG pair from a package's property list, the  .APV
  2027. and  .PAK pairs from a variable's property lists, and  the  .DEF
  2028. and .PAK pairs from a procedure's property list. erall does  not
  2029. remove any other property pairs from a property list. So,  after
  2030. you  input  a  buried package name to erall,  glist  .BUR  still
  2031. outputs the name of the erased package. To completely remove the
  2032. name  from  your workspace, you must use a  remprop  command  to
  2033. eliminate all pairs from its property list.
  2034.  
  2035. Examples:
  2036. These examples assume you have two packages named draw.pack  and
  2037. move.pack in your workspace.
  2038.  
  2039. ?erall
  2040.  
  2041. This command erases the definitions of all unburied  procedures,
  2042. variables, and packages from Dr. Logo's workspace.
  2043.  
  2044. ?erall "draw.pack
  2045.  
  2046. This command erases the definitions of procedures and  variables
  2047. in the draw.pack package, as well as the definition of draw.pack
  2048. as a package name.
  2049.  
  2050. ?erall [draw.pack move.pack]
  2051.  
  2052. This   command  erases  the  definitions  of   the   procedures,
  2053. variables,  and  package  names associated  with  draw.pack  and
  2054. move.pack.
  2055.  
  2056.  
  2057. erase er
  2058. --------
  2059.  
  2060. Action:
  2061. Erases the specified procedure(s) from the workspace.
  2062.  
  2063. Syntax:
  2064. erase procname | procname_list
  2065. er procname | procname_list
  2066.  
  2067. Explanation:
  2068. erase  erases  the specified procedure or  procedures  from  Dr.
  2069. Logo's  workspace. erase works by removing the .DEF pair from  a
  2070. procedure's  property  list. If a procedure has  other  property
  2071. pairs  in  its  list besides .DEF, you  must  remove  them  with
  2072. remprop  to  completely  erase  the  procedure  name  from   the
  2073. workspace.
  2074.  
  2075. Examples:
  2076. Each  of  these examples assume you have  two  procedures  named
  2077. wheel and flag in a package named mandala in your workspace.
  2078.  
  2079. ?erase "wheel
  2080.  
  2081. This  command erases the definition of the wheel procedure  from
  2082. Dr. Logo's workspace.
  2083.  
  2084. ?erase [wheel flag]
  2085.  
  2086. This command erases the definitions of the procedures wheel  and
  2087. flag from Dr. Logo's workspace.
  2088.  
  2089. ?plist "wheel
  2090. [.PAK mandala [[] [repeat 12[flag lt 30]!
  2091. ]]]
  2092. ?er "wheel
  2093. ?plist "wheel
  2094. [.PAK mandala]
  2095.  
  2096. er  removes  only the definition pair from  a  procedure  name's
  2097. property list. Use remprop to delete .PAK.
  2098.  
  2099.  
  2100. erasefile
  2101. ---------
  2102.  
  2103. Action:
  2104. Erases the specified Dr. Logo file.
  2105.  
  2106. Syntax:
  2107. erasefile fname
  2108.  
  2109. Explanation:
  2110. erasefile  erases  a file name from a disk  directory.  You  can
  2111. enter  a drive name before the file name to erase a file not  on
  2112. the  default drive. erasefile asks you to confirm that you  want
  2113. to  erase the file, so that you can check that the correct  file
  2114. will be erased.
  2115.  
  2116. erasefile accepts an ambiguous file name as input. An  ambiguous
  2117. file name can refer to more than one file because it contains  a
  2118. wildcard  character and gives Dr. Logo a pattern to  match.  Dr.
  2119. Logo can then erase any files whose names match the pattern.
  2120.  
  2121. The  wildcard character is a question mark ("?"). When the  last
  2122. character in your input file name is a question mark,  erasefile
  2123. erases  any  files whose names begin with  the  characters  that
  2124. precede the question mark.
  2125.  
  2126. Examples:
  2127. Each of these examples assume you have two files named  piglatin
  2128. and plaid on the disk in drive B:.
  2129.  
  2130. ?erasefile "b:piglatin
  2131. [PIGLATIN] will be erased from drive B
  2132. Is this what you want? (y/n)
  2133.  
  2134. If  you  press  y, erasefile erases the file. If  you  press  n,
  2135. erasefile does nothing.
  2136.  
  2137. ?erasefile "b:p?
  2138. [PIGLATIN PLAID] will be erased from dr!
  2139. ive B
  2140. Is this what you want? (y/n)
  2141.  
  2142. If  you  press y, erasefile erases piglatin and plaid  from  the
  2143. disk in drive B.
  2144.  
  2145.  
  2146. erasepic
  2147. --------
  2148.  
  2149. Action:
  2150. Erases the specified Dr. Logo image file.
  2151.  
  2152. Syntax:
  2153. erasepic fname
  2154.  
  2155. Explanation:
  2156. erasepic erases a Dr. Logo image filename from a disk directory.
  2157. You can enter a drive name before the image filename to erase  a
  2158. image  file  not  on the default drive.  erasepic  asks  you  to
  2159. confirm  that you want to erase the image file, so that you  can
  2160. check that the correct image file will be erased.
  2161.  
  2162. erasepic  accepts  an  ambiguous image  filename  as  input.  An
  2163. ambiguous  image filename can refer to more than one image  file
  2164. because  it contains a wildcard character and gives Dr.  Logo  a
  2165. pattern to match. Dr. Logo can then erase any image files  whose
  2166. names match the pattern.
  2167.  
  2168. The  wildcard character is a question mark ("?"). When the  last
  2169. character  in  your  input image filename is  a  question  mark,
  2170. erasepic  erases  any  image files whose names  begin  with  the
  2171. characters that precede the question mark.
  2172.  
  2173. Examples:
  2174. Each  of  these examples assume you have two image  files  named
  2175. piglatin and plaid on the disk in drive B:.
  2176.  
  2177. ?erasepic "b:piglatin
  2178. [PIGLATIN] will be erased from drive B
  2179. Is this what you want? (y/n)
  2180.  
  2181. If  you  press  y, erasepic erases the file.  If  you  press  n,
  2182. erasepic does nothing.
  2183.  
  2184. ?erasepic "b:p?
  2185. [PIGLATIN PLAID] will be erased from dr!
  2186. ive B
  2187. Is this what you want? (y/n)
  2188.  
  2189. If you press y, erasepic erases piglatin and plaid from the disk
  2190. in drive B.
  2191.  
  2192.  
  2193. ern     (= ERase one Name)
  2194. ---
  2195.  
  2196. Action:
  2197. Erases the specified variable(s) from the workspace.
  2198.  
  2199. Syntax:
  2200. ern varname | varname_list
  2201.  
  2202. Explanation:
  2203. ern  erases a specified variable name or names from  Dr.  Logo's
  2204. workspace. ern works by removing the .APV pair from the  proerty
  2205. list associated with the variable name. If a variable has  other
  2206. property  pairs  in its list besides .APV you must  remove  them
  2207. with  remprop  to completely erase the variable  name  from  the
  2208. workspace.
  2209.  
  2210. Examples:
  2211. Each  of these examples assume you have two variables named  big
  2212. and small in a package named size in your workspace.
  2213.  
  2214. ?ern "big
  2215.  
  2216. This  command  erases  the variable name  big  from  Dr.  Logo's
  2217. workspace.
  2218.  
  2219. ?ern [big small]
  2220.  
  2221. This  command erases the variable names big and small  from  Dr.
  2222. Logo's workspace.
  2223.  
  2224. ?plist "big
  2225. [.PAK size .APV 80]
  2226. ?ern "big
  2227. ?plist "big
  2228. [.PAK size]
  2229.  
  2230. ern  removes only the .APV pair from a variable name's  property
  2231. list. Use remprop to remove .PAK.
  2232.  
  2233.  
  2234. erns    (= ERase several NameS)
  2235. ----
  2236.  
  2237. Action:
  2238. Erases  all  the  variables  from  the  workspace  or  specified
  2239. package(s).
  2240.  
  2241. Syntax:
  2242. erns <pkgname | pkgname_list>
  2243.  
  2244. Explanation:
  2245. erns erases a group of variable names from Dr. Logo's workspace.
  2246. erns  without an input name erases all variable names  from  Dr.
  2247. Logo's  workspace,  except  for any  variable  names  in  buried
  2248. packages. You can give erns a package name or a list of  package
  2249. names  to specify a group of variables names to be erased.  erns
  2250. can  accept a buried package name as input; with  this  request,
  2251. erns can remove the value from a variable in a buried package.
  2252.  
  2253. erns  works  by removing the .APV pair from  a  variable  name's
  2254. property  list. It does not remove any other pair, such  as  the
  2255.  
  2256.  
  2257.  
  2258. you use erns with a package name as input and list the  contents
  2259. of  the  package with poprim, you will still see  your  variable
  2260. names  listed under the package name, even though they  have  no
  2261. values.
  2262.  
  2263. Examples:
  2264. These examples assume you have two packages named draw.pack  and
  2265. move.pack in your workspace.
  2266.  
  2267. ?erns "draw.pack
  2268.  
  2269. This  command  erases  all variable  names  from  the  draw.pack
  2270. package.
  2271.  
  2272. ?erns [draw.pck move.pack]
  2273.  
  2274. This  command erases all variable names from the  draw.pack  and
  2275. move.pack packages.
  2276.  
  2277.  
  2278. erps    (= ERase ProcedureS)
  2279. ----
  2280.  
  2281. Action:
  2282. Erases  all  the  procedures from  the  workspace  or  specified
  2283. package(s).
  2284.  
  2285. Syntax:
  2286. erps <pkgname | pkgname_list>
  2287.  
  2288. Explanation:
  2289. erps  erases  a group of procedures from Dr.  Logo's  workspace.
  2290. erps without an input name erases all procedures from Dr. Logo's
  2291. workspace, except for any procedures in buried packages. You can
  2292. give erps a package name or a list of package names to specify a
  2293. group  of  procedures  to be erased. erps can  accept  a  buried
  2294. package  name as input; with this request, erns can  remove  the
  2295. definition from a procedure name in a buried package.
  2296.  
  2297. erps  works  by removing the .DEF pair from a  procedure  name's
  2298. property list. It does not remove any other property. Therefore,
  2299. after  you  use erps with a package name as input and  list  the
  2300. contents  of  the package with poprim, you will still  see  your
  2301. procedure names listed as regular names under the package name.
  2302.  
  2303. Examples:
  2304. These examples assume you have two packages named draw.pack  and
  2305. move.pack in your workspace.
  2306.  
  2307. ?erps
  2308.  
  2309. This command erases all procedures, and leaves variables.
  2310.  
  2311. ?erps "draw.pack
  2312.  
  2313. This command erases all procedures from the draw.pack package.
  2314.  
  2315. ?erps [draw.pck move.pack]
  2316.  
  2317. This  command erases all procedure names from the draw.pack  and
  2318. move.pack packages.
  2319.  
  2320.  
  2321. error
  2322. -----
  2323.  
  2324. Action:
  2325. Outputs a list whose elements describe the most recent error.
  2326.  
  2327. Syntax:
  2328. error
  2329.  
  2330. Explanation:
  2331. error can output a list that describes the most recent error. If
  2332. the  most  recent error has already displayed a message  on  the
  2333. screen,  or  if error has already output a list  describing  the
  2334. most recent error, error outputs an empty list.
  2335.  
  2336. A  nonempty error output list contains six elements to  describe
  2337. an error:
  2338.  
  2339.      1)  A  number  that identifies the error.  Dr.  Logo  error
  2340. numbers are listed in Appendix A, "Dr. Logo Error Messages".
  2341.  
  2342.      2)  A message that explains the error. This is the  message
  2343. that is usually displayed on the screen.
  2344.  
  2345.      3)  The name of the procedure that contains  the  erroneous
  2346. expression.  If the error occurred at toplevel, this element  is
  2347. an empty list.
  2348.  
  2349.      4)   The   complete  line  that  contains   the   erroneous
  2350. expression.
  2351.  
  2352.      5) The procedure name part of the erroneous expression,  if
  2353. any.
  2354.  
  2355.      6)  The input object part of the erroneous  expression,  if
  2356. any.
  2357.  
  2358. Dr. Logo can take one of two actions when an error occurs. Which
  2359. action  Dr.  Logo  takes depends on  a  system  variable  called
  2360. ERRACT. The default state of ERRACT is FALSE. You can set ERRACT
  2361. to TRUE with a make statement.
  2362.  
  2363. While ERRACT is FALSE, Dr. Logo runs a throw "error command when
  2364. an  error occurs. If no catch "error command has been  run,  Dr.
  2365. Logo  terminates  execution of the procedure,  prints  an  error
  2366. message,  and returns to toplevel. If the error occurred  within
  2367. the  scope  of a catch "error command, Dr. Logo returns  to  the
  2368. line  following  the catch "error without  displaying  an  error
  2369. message  on  the screen. This allows you to handle an  error  in
  2370. your  own  way. The description of the catch  command  gives  an
  2371. example of how to display a custom error message.
  2372.  
  2373. While  ERRACT  is TRUE, Dr. Logo causes a pause  when  an  error
  2374. occurs.  During the pause, you can execute an error  command  to
  2375. discover the cause of the error, then change variables with make
  2376. or  procedures with ed before entering co to continue  execution
  2377. of the procedure.
  2378.  
  2379. Examples:
  2380. ?to safety.circle :size
  2381. >catch "error [repeat 180 [fd :size rt !
  2382. 2]
  2383. >show error
  2384. >end
  2385. safety.circle defined
  2386. ?safety.circle 2
  2387. []
  2388. ?safety.circle "two
  2389. [41 [fd doesn't like two as input] safe!
  2390. ty.circle [!
  2391. catch "error [repeat 180 fd :size rt 2]!
  2392. ]] fd rt]
  2393.  
  2394. See Colorplate 14. safety.circle (error Primitive)
  2395.  
  2396.  
  2397.  .examine
  2398.  --------
  2399.  
  2400. Action:
  2401. Displays the contents of a memory location.
  2402.  
  2403. Syntax:
  2404.  .examine n
  2405.  
  2406. Explanation:
  2407. Displays  the  contents (a byte value) of  the  memory  location
  2408. specified by the input number. This location is relative to  the
  2409. absolute location established by .SETSEG. THIS PRIMITIVE  SHOULD
  2410. BE USED WITH CAUTION!
  2411.  
  2412. Examples:
  2413. ?.examine 22
  2414. 0
  2415.  
  2416.  
  2417. exp
  2418. ---
  2419.  
  2420. Action:
  2421. Outputs the natural exponent of the input number.
  2422.  
  2423. Syntax:
  2424. exp n
  2425.  
  2426. Explanation:
  2427. exp outputs the natural exponent of the input number.
  2428.  
  2429. Examples:
  2430. ?exp 1
  2431. 2.71828182845905
  2432. ?log (exp 1)
  2433. 1
  2434.  
  2435.  
  2436. fence
  2437. -----
  2438.  
  2439. Action:
  2440. Establishes  a  boundary  that limits  the  turtle  to  onscreen
  2441. plotting.
  2442.  
  2443. Syntax:
  2444. fence
  2445.  
  2446. Explanation:
  2447. fence  establishes  a boundary around the edge  of  the  graphic
  2448. screen.  The fence limits the turtle to onscreen plotting.  When
  2449. the turtle encounters the fence, Dr. Logo displays a "Turtle out
  2450. of bounds" message. The number of turtle steps from home to  the
  2451. fence are as follows:
  2452.  
  2453.                  100
  2454.             +-----------+
  2455.             |           |
  2456.         160 |           | 159
  2457.             |           |
  2458.             +-----------+
  2459.                   99
  2460.  
  2461. To remove the fence, enter window.
  2462.  
  2463. Examples:
  2464. ?to fly
  2465. >fence
  2466. >buzz
  2467. >end
  2468. fly defined
  2469. ?to buzz
  2470. >catch "error [zoom]
  2471. >lt 180
  2472. >buzz
  2473. >end
  2474. buzz defined
  2475. ?to zoom
  2476. >rt random 180
  2477. >fd random 50
  2478. >zoom
  2479. >end
  2480. zoom defined
  2481. ?fly
  2482.  
  2483. See Colorplate 15. fly (fence Primitive)
  2484.  
  2485.  
  2486. fill
  2487. ----
  2488.  
  2489. Action:
  2490. Fills an area.
  2491.  
  2492. Syntax:
  2493. fill
  2494.  
  2495. Explanation:
  2496. Fills  an  area with the current pencolor by  changing  the  dot
  2497. under the turtle (and all horizontally and vertically contiguous
  2498. dots  of  the  same color) to the current  pencolor,  using  the
  2499. current pen state.
  2500.  
  2501. Examples:
  2502. ?fill
  2503.  
  2504.  
  2505. first
  2506. -----
  2507.  
  2508. Action:
  2509. Outpus the first element of the input object.
  2510.  
  2511. Syntax:
  2512. first object
  2513.  
  2514. Explanation:
  2515. first  outputs the first element of the input object. The  first
  2516. of  a word or number is a single character. The first of a  list
  2517. is either a word or a list. first of an empty word or empty list
  2518. outputs an error.
  2519.  
  2520. Examples:
  2521. ?first []
  2522. first doesn't like [] as input
  2523. ?first "
  2524. first doesn't like an empty word as inp!
  2525. ut
  2526. ?first "rose
  2527. r
  2528. ?first [weight 165]
  2529. weight
  2530. ?to begin.vowelp :wrd
  2531. >op memberp first :wrd [a e i o u]
  2532. >end
  2533. begin.vowelp defined
  2534. ?to pig :wrd
  2535. >if begin.vowelp :wrd
  2536. >    [op word :wrd "ay]
  2537. >    [op pig word (bf :wrd) (first :wrd!
  2538. )]
  2539. >end
  2540. pig defined
  2541. ?to piglatin :phrase
  2542. >if emptyp :phrase [op []]
  2543. >output se (pig first :phrase) (piglati!
  2544. n bf :phrase)
  2545. >end
  2546. piglatin defined
  2547. ?piglatin [a ball of string]
  2548. [aay allbay ofay ingstray]
  2549.  
  2550.  
  2551. follow
  2552. ------
  2553.  
  2554. Action:
  2555. Reorganizes  workspace, so that the first input-named  procedure
  2556. is followed by the second.
  2557.  
  2558. Syntax:
  2559. follow procname procname
  2560.  
  2561. Explanation:
  2562. follow reorganizes the workspace, so that the first  input-named
  2563. procedure  is  followed  by the second? You can  use  follow  to
  2564. specify  the order in which Dr. Logo displays  procedure  titles
  2565. and definitions (poall, pops, pots, proclist), saves  procedures
  2566. on  disk (save), and loads procedures into the  screen  editor's
  2567. buffer  (edall,  edps).  follow does not  change  the  order  of
  2568. procedures in a package definition.
  2569.  
  2570. Examples:
  2571. These  examples  assume you have three  procedures  named  zoom,
  2572. buzz, and fly in a package named fly in your workspace.
  2573.  
  2574. ?pots
  2575. zoom
  2576. fly
  2577. buzz
  2578. ?popkg
  2579. fly
  2580.   to zoom
  2581.   to fly
  2582.   to buzz
  2583. ?follow "buzz "zoom
  2584. ?pots "fly
  2585. fly
  2586. buzz
  2587. zoom
  2588. ?popkg
  2589. fly
  2590.   to zoom
  2591.   to fly
  2592.   to buzz
  2593.  
  2594.  
  2595. form    (= real FORMat)
  2596. ----
  2597.  
  2598. Action:
  2599. Outputs a number in real notation.
  2600.  
  2601. Syntax:
  2602. form n1 n2 <n3>
  2603.  
  2604. Explanation:
  2605. Outputs  a number, n1, with n2 digits before the decimal  point,
  2606. and  n3  after  it. n1 must be a positive, real  number  from  1
  2607. through  15.  If  n1 is not an integer, it  is  rounded  to  the
  2608. nearest integer. If n3 is omitted, it is assumed to be zero  and
  2609. the decimal point and any digits after it are not printed.
  2610.  
  2611. Examples:
  2612. ?form 1.234 2
  2613.  1
  2614.  
  2615.  
  2616. forward fd
  2617. ----------
  2618.  
  2619. Action:
  2620. Moves  the turtle the input number of steps in the direction  of
  2621. its current heading.
  2622.  
  2623. Syntax:
  2624. forward distance_n
  2625. fd distance_n
  2626.  
  2627. Explanation:
  2628. forward  moves  the  turtle the input number  of  steps  in  the
  2629. direction  of its current heading. If the turtle's pen is  down,
  2630. the  turtle  leaves  a trace of its path. On  the  IBM  Personal
  2631. COmputer, a turtle step is equivalent to one dot (pixel).
  2632.  
  2633. Examples:
  2634. ?forward 100
  2635. ?cs
  2636. ?to plaid
  2637. >wrap
  2638. >setpc 3 rt 40 forward 10965
  2639. >setpc 2 rt 90 forward 5000
  2640. >setpc 1 pu rt 90 fd 6 pd ht
  2641. >repeat 625 [fd 3 lt 90 fd 1 rt 90 bk 3!
  2642. lt 90 fd 1 rt 90]
  2643. >end
  2644. plaid defined
  2645. ?plaid
  2646.  
  2647. See Colorplate 16. plaid (forward Primitive)
  2648.  
  2649.  
  2650. fput    (= First PUT)
  2651. ----
  2652.  
  2653. Action:
  2654. Outputs a new object formed by making the first input object the
  2655. first element in the second input object.
  2656.  
  2657. Syntax:
  2658. fput object object
  2659.  
  2660. Explanation:
  2661. fput  outputs  a  new object formed by making  the  first  input
  2662. object the first element in the second input object.  Generally,
  2663. the  new object is the same kind of object as the  second  input
  2664. object:  a word, number, or list. However, when you fput a  word
  2665. into a number, fput outputs a word.
  2666.  
  2667. Examples:
  2668. ?fput "s "miles
  2669. smiles
  2670. ?fput "banana [grape strawberry melon]
  2671. [banana grape strawberry melon]
  2672. ?fput 20 20
  2673. 2020
  2674. ?fput [corn dog] [hamburger taco pizza]
  2675. [[corn dog] hamburger taco pizza]
  2676. ?to exchange :from :to :in
  2677. >if emptyp :in [op []]
  2678. >if (first :in) = :from
  2679. >   [output fput :to exchange :from :to !
  2680. bf :in]
  2681. >   [output se first :in exchange :from !
  2682. :to bf :in]
  2683. >end
  2684. exchange defined
  2685. ?exchange "cat "dog [My cat has fleas.]
  2686. [My dog has fleas.]
  2687.  
  2688.  
  2689. fullscreen fs
  2690. -------------
  2691.  
  2692. Action:
  2693. Selects full graphic screen.
  2694.  
  2695. Syntax:
  2696. fullscreen
  2697. fs
  2698.  
  2699. Explanation:
  2700. fullscreen  removes  the  splitscreen or text  screen  from  the
  2701. display,  and dedicates the monitor to graphics.  fullscreen  is
  2702. equivalent  to a Ctrl-L keystroke. Generally, it is  easiest  to
  2703. use  Ctrl-L when you are typing commands at your  keyboard,  and
  2704. fullscreen (fs) from within a procedure.
  2705.  
  2706. Examples:
  2707. ?repeat 12[repeat 4[fd 60 rt 90]rt 30]
  2708. ?splitscreen
  2709. ?fullscreen
  2710.  
  2711. See Colorplate 17. fullscreen (fullscreen Primitive)
  2712.  
  2713.  
  2714. glist   (= Get property LIST)
  2715. -----
  2716.  
  2717. Action:
  2718. Outputs  a  list of all objects in the  workspace  or  specified
  2719. package(s) that have the input property in their property lists.
  2720.  
  2721. Syntax:
  2722. glist prop <pkgname | pkgname_list>
  2723.  
  2724. Explanation:
  2725. With  or without an input, glist outputs a list of objects  that
  2726. have  the  input property in their property  lists.  Without  an
  2727. input,  glist  checks the property lists of all objects  in  the
  2728. workspace.  If you specify a package name or a list of  packages
  2729. in  the glist expression, glist checks only the objects  in  the
  2730. specified package(s).
  2731.  
  2732. Property lists and Dr. Logo's system properties are described in
  2733. Section 5, "Property Lists, Workspace, and Disks". To understand
  2734. the  examples below, remember that .DEF is the  system  property
  2735. Dr. Logo gives to defined procedures.
  2736.  
  2737. Examples:
  2738. These examples assume that, in your workspace, you have packages
  2739. named fly and piglatin.
  2740.  
  2741. ?glist ".DEF
  2742. [countdown piglatin begin.vowelp fly bu!
  2743. zz triangle.text zoom pig]
  2744. ?glist ".DEF "fly
  2745. [fly buzz zoom]
  2746. ?glist ".DEF [fly piglatin]
  2747. [piglatin begin.vowelp fly buzz zoom pi!
  2748. g]
  2749.  
  2750.  
  2751. go
  2752. --
  2753.  
  2754. Action:
  2755. Executes  the  line within the current procedure  identified  by
  2756. label and the input word.
  2757.  
  2758. Syntax:
  2759. go word
  2760.  
  2761. Explanation:
  2762. go executes the line within the current procedure identified  by
  2763. label  and the input word. This means that, after go,  Dr.  Logo
  2764. will  next execute the line following the label expression.  The
  2765. go  and label expressions must have the same input word, and  be
  2766. in the same procedure.
  2767.  
  2768. go  and  label  let you change the sequence in  which  Dr.  Logo
  2769. executes  the  lines  in a procedure. Therefore,  go  and  label
  2770. cannot  be  on the same line. This means you cannot use  go  and
  2771. label  within an instruction list input to repeat, run,  or  the
  2772. ifs.
  2773.  
  2774. Examples:
  2775. ?to triangle.text :string
  2776. >label "loop
  2777. >if emptyp :string [stop]
  2778. >pr :string
  2779. >make "string bf :string
  2780. >go "loop
  2781. >end
  2782. triangle.text defined
  2783. ?triangle.text [Get along little dogie.]
  2784. Get along little dogie.
  2785. along little dogie.
  2786. little dogie.
  2787. dogie.
  2788. ?to countdown :n
  2789. >label "loop
  2790. >if :n < 0 [stop]
  2791. >type :n
  2792. >make "n (:n - 1)
  2793. >go "loop
  2794. >end
  2795. countdown defined
  2796. ?countdown 9
  2797. 9876543210
  2798.  
  2799.  
  2800. gprop   (= Get PROPerty)
  2801. -----
  2802.  
  2803. Action:
  2804. Outputs the value of the input-named property of the input-named
  2805. object.
  2806.  
  2807. Syntax:
  2808. gprop name prop
  2809.  
  2810. Explanation:
  2811. gprop  outputs  the  value of the input-named  property  of  the
  2812. input-named  object. The input name identifies the  object  that
  2813. has  the property. If the object does not have  the  input-named
  2814. property, gprop outputs an empty list.
  2815.  
  2816. Section  5,  "Property Lists, Workspace, and  Disks",  describes
  2817. property  lists,  and defines the properties Dr. Logo  gives  to
  2818. objects  in  the workspace. To understand  the  examples  below,
  2819. remember  that a proerty list is made up of property pairs.  The
  2820. first  element  of  the pair is the property;  the  second,  its
  2821. value. Dr. Logo gives defined properties the .DEF property,  and
  2822. defined variables the .APV property.
  2823.  
  2824. Examples:
  2825. This  example  assumes you have a procedure named  pig  in  your
  2826. workspace.
  2827.  
  2828. ?gprop "pig ".DEF
  2829. [[wrd] if begin.vowelp :wrd [op word :w!
  2830. rd "ay]
  2831. [op ! pig word (bf :wrd) (first :wrd)]]
  2832. ?make "height "72"
  2833. ?gprop "height ".APV
  2834. 72"
  2835. ?gprop "height ".DEF
  2836. []
  2837.  
  2838.  
  2839. heading
  2840. -------
  2841.  
  2842. Action:
  2843. Outputs a number that indicates the turtle's current heading.
  2844.  
  2845. Syntax:
  2846. heading
  2847.  
  2848. Explanation:
  2849. heading  outputs the turtle's current heading as a  real  number
  2850. between 0 and 359 inclusive. The turtle's heading corresponds to
  2851. traditional compass headings:
  2852.  
  2853.       Degrees         Direction       Pointing
  2854.       -------         ---------       --------
  2855.           0             North           up
  2856.          90             East            right
  2857.         180             South           down
  2858.         270             West            left
  2859.  
  2860. Examples:
  2861. ?home show heading
  2862. 0
  2863. ?rt 1 show heading
  2864. 1
  2865. ?rt 1 show heading
  2866. 2
  2867. ?lt random 360 heading
  2868. 126
  2869. ?to compass :n
  2870. >if memberp :n [0 90 180 270] [points]
  2871. >if (:n > 360) [stop]
  2872. >(type heading char 9)
  2873. >rt 5 pu fd 25 pd fd 5 pu bk 30
  2874. >compass :n + 5
  2875. >end
  2876. compass defined
  2877. ?to points
  2878. >pu
  2879. >fd 40
  2880. >if :n = 0 [tt "N]
  2881. >if :n = 90 [tt "E]
  2882. >if :n = 180 [tt "S]
  2883. >if :n = 270 [tt "W]
  2884. >setpos [0 0]
  2885. >end
  2886. points defined
  2887. ?compass 0
  2888.  
  2889. See Colorplate 18. compass (heading Primitive)
  2890.  
  2891.  
  2892. help
  2893. ----
  2894.  
  2895. Action:
  2896. Displays the names and abbreviations of all Dr. Logo primitives.
  2897.  
  2898. Syntax:
  2899. help <primitive>
  2900.  
  2901. Explanation:
  2902. help  displays  the  names and abbreviations  of  all  Dr.  Logo
  2903. primitives.
  2904.  
  2905. help  displays only 25 names on the screen at a time.  It  waits
  2906. for you to press any key before displaying the next 25 names.
  2907.  
  2908. Examples:
  2909. ?help
  2910.  
  2911. help displays the list of all Dr. Logo primitives. Press any key
  2912. to view next screenful of names.
  2913.  
  2914.  
  2915. hideturtle ht
  2916. -------------
  2917.  
  2918. Action:
  2919. Makes the turtle invisible.
  2920.  
  2921. Syntax:
  2922. hideturtle
  2923. ht
  2924.  
  2925. Explanation:
  2926. hideturtle  makes  the  turtle invisible.  When  invisible,  the
  2927. turtle  draws  faster and does not distract  visually  from  the
  2928. drawing. To make the turtle visible again, enter showturtle.
  2929.  
  2930. Examples:
  2931. ?hideturtle
  2932. ?showturtle
  2933. ?to start :size
  2934. >repeat 5 [fd :size lt 217 fd :size lt !
  2935. 71]
  2936. >end
  2937. star defined
  2938. ?star 30
  2939. ?ht
  2940.  
  2941. See Colorplate 19. hideturtle (hideturtle Primitive)
  2942.  
  2943.  
  2944. home
  2945. ----
  2946.  
  2947. Action:
  2948. Returns the turtle to position [0 0] (the center of the  graphic
  2949. screen) heading 0 (North).
  2950.  
  2951. Syntax:
  2952. home
  2953.  
  2954. Explanation:
  2955. home positions the turtle at "home", position [0 0] (the  center
  2956. of the screen), heading 0 (North). Home is the position in which
  2957. the turtle first appears when you start Dr. Logo.
  2958.  
  2959. home does not change the turtle's pen state. For example, if the
  2960. turtle's  pen is down when home is executed, the turtle draws  a
  2961. line from its current loation to the center of the screen.
  2962.  
  2963. Examples:
  2964. ?fd 80 lt 120 fd 80
  2965. ?home
  2966.  
  2967. See Colorplate 20. home (home Primitive)
  2968.  
  2969.  
  2970. if
  2971. --
  2972.  
  2973. Action:
  2974. Executes  one of two instructions lists, depending on the  value
  2975. of the input predicate expression.
  2976.  
  2977. Syntax:
  2978. if pred_exp instr_list <instr_list>
  2979.  
  2980. Explanation:
  2981. If  transfers  execution  to  one  of  two  instruction   lists,
  2982. depending  on  the TRUE or FALSE value of  the  input  predicate
  2983. expression.  You  can use an if expression to  make  a  decision
  2984. regarding the flow of control within your procedure.
  2985.  
  2986. The  first input to if must be a predicate expression, one  that
  2987. outputs  TRUE or FALSE. If the predicate outputs TRUE, Dr.  Logo
  2988. executes  the first instruction list. If the  predicate  outputs
  2989. FALSE, Dr. Logo executes either the second instruction list  (if
  2990. any), or the next line in the procedure.
  2991.  
  2992. if requires literal instruction lists as input; that is to  say,
  2993. an  instruction  list  input to if must be  enclosed  in  square
  2994. brackets  ("[" and "]"). Dr. Logo allows nested if  expressions.
  2995. This  means  you can use an if statement within  an  instruction
  2996. list you input to if.
  2997.  
  2998. Examples:
  2999. ?setheading random 360
  3000. ?if heading < 180 [pr "East] [pr "West]
  3001. West
  3002.  
  3003. The coin procedures that follow demonstrate several ways to  use
  3004. if.  coin1 shows if making a simple decision between  two  input
  3005. instruction lists.
  3006.  
  3007. ?to coin1
  3008. >if l = random 2 [pr "heads] [pr "tails]
  3009. >end
  3010. coin1 defined
  3011.  
  3012. coin2 shows if providing input to another procedure.
  3013.  
  3014. ?to coin2
  3015. >pr if l = random 2 ["heads] ["tails]
  3016. >end
  3017. coin2 defined
  3018.  
  3019. coin3  shows how if executes the next line in a procedure if  no
  3020. second instruction list is input.
  3021.  
  3022. ?to coin3
  3023. >if l = random 2 [op "heads]
  3024. >op "tails
  3025. >end
  3026. coin3 defined
  3027.  
  3028. coin4  shows  how  the second instruction list  makes  the  line
  3029. following the if expression independent of the results of the if
  3030. test.
  3031.  
  3032. ?to coin4
  3033. >if l = random 2
  3034. >   [type "heads]
  3035. >   [type "tails]
  3036. >pr [\ side up]
  3037. >end
  3038. coin4 defined
  3039.  
  3040.  
  3041. iffalse iff
  3042. -----------
  3043.  
  3044. Action:
  3045. Executes the input instruction list if the most recent test  was
  3046. FALSE.
  3047.  
  3048. Syntax:
  3049. iffalse instr_list
  3050. iff instr_list
  3051.  
  3052. Explanation:
  3053. iffalse executes its input instruction list if the result of the
  3054. most recent test expression was FALSE. If the result of test was
  3055. TRUE, iffalse does nothing.
  3056.  
  3057. You  can use test, iffalse, and iftrue as an alternate to if  to
  3058. control  the  flow  of execution within  your  procedure.  These
  3059. primitives  are  particularly useful when you need Dr.  Logo  to
  3060. evaluate expressions after it evaluates a predicate  expression,
  3061. but before it executes the chose instruction list.
  3062.  
  3063. iffalse requires a literal instruction list as input; that is to
  3064. say, any instruction list you input to iffalse must be  enclosed
  3065. in  squae  brackets  ("[" and "]"). Dr. Logo  allows  nested  if
  3066. expressions.  This means you can use test, iffalse,  and  iftrue
  3067. within the instruction list you input to iffalse.
  3068.  
  3069. Examples:
  3070. The  coin5 procedure is similar to the coin procedures shown  as
  3071. examples  under  if,  but shows how to use  test,  iffalse,  and
  3072. iftrue.  coin5  evaluates  a expression  after  it  evaluates  a
  3073. predicate   expression,  but  before  it  executes  the   chosen
  3074. instruction list.
  3075.  
  3076. ?to coin5
  3077. >test l = random 2
  3078. >if l = random 1000000 [pr [Landed on e!
  3079. dge!] stop]
  3080. >ift [type "heads ]
  3081. >iff [type "tails ]
  3082. >pr [\ side up]
  3083. >end
  3084. coin5 defined
  3085.  
  3086.  
  3087. iftrue ift
  3088. ----------
  3089.  
  3090. Action:
  3091. Executes the input instruction list if the most recent test  was
  3092. TRUE.
  3093.  
  3094. Syntax:
  3095. iftrue instr_list
  3096. ift instr_list
  3097.  
  3098. Explanation:
  3099. iftrue executes its input instruction list if the result of  the
  3100. most recent test expression was TRUE. If the result of test  was
  3101. FALSE, iftrue does nothing.
  3102.  
  3103. You  can use test, iffalse, and iftrue as an alternate to if  to
  3104. control  the  flow  of execution within  your  procedure.  These
  3105. primitives  are  particularly useful when you need Dr.  Logo  to
  3106. evaluate expressions after it evaluates a predicate  expression,
  3107. but before it executes the chose instruction list.
  3108.  
  3109. iftrue requires a literal instruction list as input; that is  to
  3110. say,  any instruction list you input to iftrue must be  enclosed
  3111. in  squae  brackets  ("[" and "]"). Dr. Logo  allows  nested  if
  3112. expressions.  This means you can use test, iffalse,  and  iftrue
  3113. within the instruction list you input to iffalse.
  3114.  
  3115. Examples:
  3116. The  coin5 procedure is similar to the coin procedures shown  as
  3117. examples  under  if,  but shows how to use  test,  iffalse,  and
  3118. iftrue.  coin5  evaluates  a expression  after  it  evaluates  a
  3119. predicate   expression,  but  before  it  executes  the   chosen
  3120. instruction list.
  3121.  
  3122. ?to coin5
  3123. >test l = random 2
  3124. >if l = random 1000000 [pr [Landed on e!
  3125. dge!] stop]
  3126. >ift [type "heads ]
  3127. >iff [type "tails ]
  3128. >pr [\ side up]
  3129. >end
  3130. coin5 defined
  3131.  
  3132.  
  3133.  .in
  3134.  ---
  3135.  
  3136. Action:
  3137. Displays the contents of a I/O port.
  3138.  
  3139. Syntax:
  3140.  .in port_n
  3141.  
  3142. Explanation:
  3143. Displays the contents (a byte value) of the specified I/O  port.
  3144. Port numbers range from 0 to 65535.
  3145.  
  3146. Examples:
  3147. ?.in 397
  3148. 50
  3149.  
  3150.  
  3151. int
  3152. ---
  3153.  
  3154. Action:
  3155. Outputs the integer portion of the input number.
  3156.  
  3157. Syntax:
  3158. int n
  3159.  
  3160. Explanation:
  3161. int  outputs  the  integer  portion of  the  input  number.  int
  3162. discards  any  decimal point and subsequent  numerals  from  the
  3163. input number. To round a decimal number to the nearest  integer,
  3164. use round.
  3165.  
  3166. Examples:
  3167. ?int 3.333333
  3168. 3
  3169. ?int 3
  3170. 3
  3171. ?int 28753 / 12
  3172. 2396
  3173. ?int -75.482
  3174. -75
  3175. ?to integerp :n
  3176. >if numberp :n [op :n = int :n]
  3177. >(pr :n [is not a number.]
  3178. >end
  3179. integerp defined
  3180. ?integerp 6.65
  3181. FALSE
  3182. ?integerp 6
  3183. TRUE
  3184. ?integerp "six
  3185. six is not a number.
  3186.  
  3187.  
  3188. item
  3189. ----
  3190.  
  3191. Action:
  3192. Outputs the specified element of the input object.
  3193.  
  3194. Syntax:
  3195. item n object
  3196.  
  3197. Explanation:
  3198. item  outputs an element of the input object. The  input  number
  3199. specifies which element of the input object item outputs.
  3200.  
  3201. Examples:
  3202. ?item 4 "dwarf
  3203. r
  3204. ?item 2 [brownie snickerdoodle wafer]
  3205. snickerdoodle
  3206. ?make "favorites [brownie snickerdoodle!
  3207. [oatmeal raisin]]
  3208. ?count item 3 :favorites
  3209. 2
  3210. ?to make_sentence :n :v
  3211. >pr (se item ((random (count :n)) + 1) !
  3212. :n
  3213. >       item ((random (count :v)) + 1) !
  3214. :v
  3215. >end
  3216. make_sentence defined
  3217. ?make_sentence [elephants crocodiles ma!
  3218. mbasnakes] [pirouette tapdance rollersk!
  3219. ate]
  3220. mambasnake pirouette
  3221.  
  3222.  
  3223. keyp    (= KEY Predicate)
  3224. ----
  3225.  
  3226. Action:
  3227. Outputs TRUE is a character has been typed at the keyboard,  and
  3228. is waiting to be read.
  3229.  
  3230. Syntax:
  3231. keyp
  3232.  
  3233. Explanation:
  3234. keyp outputs TRUE if a character has been typed at the keyboard,
  3235. and is waiting to be read by readchar, readquote, or readlist.
  3236.  
  3237. When  you  type a character at toplevel, Dr. Logo  displays  the
  3238. character   on  the  screen.  However,  while  a  procedure   is
  3239. executing, Dr. Logo stores any characters that are typed at  the
  3240. keyboard  in a buffer, and displays them on the screen when  the
  3241. procedure  ends. By using keyp in a procedure, you can  discover
  3242. whether  or  not  your  user  has  typed  something  while  your
  3243. procedure is executing.
  3244.  
  3245. What  your  user  types  into the buffer  is  critical  if  your
  3246. procedure  contains subsequent readquote, readchar, or  readlist
  3247. expressions  that read the buffer and input its contents to  the
  3248. rest  of your procedure. You can use keyp to determine  if  your
  3249. user  has typed something, then check that the  buffer  contains
  3250. the  kind  of input your procedure requires before  passing  the
  3251. input to the procedure.
  3252.  
  3253. Examples:
  3254. ?to sketch
  3255. >fd 2
  3256. >wait 10
  3257. >if keyp [turn rc]
  3258. >sketch
  3259. >end
  3260. sketch defined
  3261. ?to turn :way
  3262. >if 6 = ascii :way [rt 10]  ; 6 for rig!
  3263. ht arrow key
  3264. >if 2 = ascii :way [lt 10]  ; 2 for lef!
  3265. t arrow key
  3266. >end
  3267. turn defined
  3268. ?sketch
  3269. ?to delay
  3270. >pr [Any keystroke delays next number b!
  3271. y a second.]
  3272. >printout
  3273. >end
  3274. delay defined
  3275. ?to printout
  3276. >if keyp [wait 60 sink rc]
  3277. >(type random 10 char 9)
  3278. >printout
  3279. >end
  3280. printout defined
  3281. ?to sink :object
  3282. >end
  3283. sink defined
  3284. Any keystroke delays next number by a s!
  3285. econd.
  3286. 6   9   2   5   8   0   3   6   1   9  !
  3287. 1   0   6   1   3   5   1   8   0   1  !
  3288. 7   Ctrl-G
  3289. ?to countstars
  3290. >make "number 1 + random 10
  3291. >drawstars :number
  3292. >pr [How many stars?]
  3293. >label "back
  3294. >if keyp
  3295. >   [make buffer readquote
  3296. >    (if not numberp first :buffer
  3297. >        [ern "buffer go "back]
  3298. >        [go on])]
  3299. >   [go "back]
  3300. >label "on
  3301. >if :number = :buffer
  3302. >   [pr "Right!]
  3303. >   [pr [Wrong! There are] :number]
  3304. >cs
  3305. >countstars
  3306. >end
  3307. countstars defined
  3308. ?to drawstars :number
  3309. >if :number = 0 [stop]
  3310. >pu setpos list
  3311. >   (random 100 * first shuffle [1 -1])
  3312. >   (random 70 * first shuffle [1 -1])
  3313. >pd star pu
  3314. >drawstars :number - 1
  3315. >end
  3316. drawstars defined
  3317. ?to star
  3318. >repeat 5 [fd 30 lt 127 fd 30 lt 70]
  3319. >end
  3320. star defined
  3321. ?countstars
  3322. How many stars?
  3323. 4
  3324. Right!
  3325. How many stars?
  3326. 5
  3327. Right!
  3328. How many stars?
  3329. 6
  3330. Wrong! There are 5
  3331. How many stars? Ctrl-G
  3332. Stopped! in countstars: go
  3333.  
  3334. See Colorplate 21. countstars (keyp Primitive)
  3335.  
  3336.  
  3337. label
  3338. -----
  3339.  
  3340. Action:
  3341. Identifies the line to be executed after a go expression.
  3342.  
  3343. Syntax:
  3344. label word
  3345.  
  3346. Explanation:
  3347. label identifies the line to be executed after a go  expression.
  3348. The label and go expressions must be in the same procedure,  and
  3349. have the same input word.
  3350.  
  3351. go  and  label  let you change the sequence in  which  Dr.  Logo
  3352. executes  the  lines  in a procedure. Therefore,  go  and  label
  3353. cannot both be on the same line. This means you cannot use  both
  3354. go and label within an instruction list input to repeat, run, or
  3355. the ifs.
  3356.  
  3357. Examples:
  3358. ?to triangle.text :string
  3359. >label "loop
  3360. >if emptyp :string [stop]
  3361. >pr :string
  3362. >make "string bf :string
  3363. >go "loop
  3364. >end
  3365. triangle.text defined
  3366. ?triangle.text [Wyoming will be your ne!
  3367. w home.]
  3368. Wyoming will be your new home.
  3369. will be your new home.
  3370. be your new home.
  3371. your new home.
  3372. new home.
  3373. home.
  3374. ?to countdown :n
  3375. >label "loop
  3376. >if :n < 0 [stop]
  3377. >type :n
  3378. >make "n (:n - 1)
  3379. >go "loop
  3380. >end
  3381. countdown defined
  3382. ?countdown 9
  3383. 9876543210
  3384.  
  3385.  
  3386. last
  3387. ----
  3388.  
  3389. Action:
  3390. Outputs the last element of the input object.
  3391.  
  3392. Syntax:
  3393. last object
  3394.  
  3395. Explanation:
  3396. last outputs the last element of the input object. The last of a
  3397. word  or  number is a single character. The last of  a  list  is
  3398. either  a  word or a list. last of an empty word or  empty  list
  3399. outputs an error.
  3400.  
  3401. Examples:
  3402. ?last []
  3403. last doesn't like [] as input
  3404. ?last "
  3405. last doesn't like an empty word as input
  3406. ?lst "skyline
  3407. e
  3408. ?last [weight 165]
  3409. 165
  3410. ?to mirror :word
  3411. >(pr reverse :word "| :word
  3412. >end
  3413. mirror defined
  3414. ?to reverse :word
  3415. >if emptyp :word [op "]
  3416. >op (word last :word reverse bl :word)
  3417. >end
  3418. reverse defined
  3419. ?mirror "mirror
  3420. rorrim | mirror
  3421.  
  3422.  
  3423. left lt
  3424. -------
  3425.  
  3426. Action:
  3427. Rotates the turtle the input number of degrees to the left.
  3428.  
  3429. Syntax:
  3430. left degrees_n
  3431. lt degrees_n
  3432.  
  3433. Explanation:
  3434. left rotates the turtle the input number of degrees to the left.
  3435. Usually,  you input a number of degreese between 0 and  359.  If
  3436. the input number is greater than 359, the turtle appears to move
  3437. the  input number minus 360 degrees to the left. If you input  a
  3438. negative number to left, the turtle turns to the right.
  3439.  
  3440. Examples:
  3441. ?repeat 36 [left 10]
  3442. ?repeat 36 [left -10]
  3443. ?to around :s
  3444. >repeat 360 [fd :s lt 10 make "s :s + .!
  3445. 01]
  3446. >end
  3447. around defined
  3448. ?around 2
  3449.  
  3450. See Colorplate 22. around (left Primitive)
  3451.  
  3452.  
  3453. list
  3454. ----
  3455.  
  3456. Action:
  3457. Outputs a list made up of the input objects.
  3458.  
  3459. Syntax:
  3460. list object object (...)
  3461.  
  3462. Explanation:
  3463. list  outputs a list made up of the input objects. list is  like
  3464. sentence,  but  does not remove the outermost brackets  from  an
  3465. input object.
  3466.  
  3467. Without  punctuation,  list  requires  and  accepts  two   input
  3468. objects.  list can accept more or fewer inputs when you  enclose
  3469. the  list expression in parentheses ["(" and ")"]. If  no  other
  3470. expressions  follow the list expression on the line, you do  not
  3471. need to type the closing right parenthesis [")"].
  3472.  
  3473. There are two ways of creating lists in Dr. Logo:
  3474.  
  3475.         1) using square brackets ("[" and "]")
  3476.         2) using list or sentence.
  3477.  
  3478. Each way results in a different kind of list. When you create  a
  3479. list by enclosing elements in square brackets ("[" and "]"), you
  3480. create  a  "literal" list. Dr. Logo treats the elements  of  the
  3481. list literally; it does not evaluate expressions or look up  the
  3482. values of variables named in a literal list.
  3483.  
  3484. When  you  use list or sentence to create a list,  you  can  use
  3485. variables and expressions to specify the elements Dr. Logo  will
  3486. put in the list. You can use list and sentence to create a  list
  3487. for  input to most procedures. However, if, iffalse, and  iftrue
  3488. require literal lists as input.
  3489.  
  3490. Examples:
  3491. ?show list "big "feet
  3492. [big feet]
  3493. ?list "potatoes [mashed baked fried]
  3494. [potatoes [mashed baked fried]]
  3495. ?(list
  3496. []
  3497. ?(list 21 22 23 24
  3498. [21 22 23 24]
  3499. ?to square
  3500. >repeat 4 [fd 60 rt 90]
  3501. >end
  3502. square defined
  3503. ?make "procname "square
  3504. ?run (list :procname
  3505.  
  3506. See Colorplate 23. run (list :procname (list Primitive)
  3507.  
  3508. ?to zipzap
  3509. >setpos list
  3510. >   random 150 * first shuffle
  3511. >   random 100 * first shuffle
  3512. >zipzap
  3513. >end
  3514. zipzap defined
  3515. ?zipzap
  3516.  
  3517. See Colorplate 24. zipzap (list Primitive)
  3518.  
  3519.  
  3520. listp   (= LIST Predicate)
  3521. -----
  3522.  
  3523. Action:
  3524. Outputs TRUE if the input object is a list.
  3525.  
  3526. Syntax:
  3527. listp object
  3528.  
  3529. Explanation:
  3530. listp  outputs  TRUE if the input object is a  list;  otherwise,
  3531. listp outputs FALSE.
  3532.  
  3533. Examples:
  3534. ?listp "force
  3535. FALSE
  3536. ?listp [father brother sister]
  3537. TRUE
  3538. ?listp "
  3539. FALSE
  3540. ?listp []
  3541. TRUE
  3542. ?to reflect :object
  3543. >if listp :object
  3544. >   [pr lreverse :object]
  3545. >   [pr reverse :object]
  3546. >end
  3547. reflect defined
  3548. ?to lreverse :list
  3549. >if emptyp :list [op "]
  3550. >op (se last :list lreverse bl :list
  3551. >end
  3552. lreverse defined
  3553. ?to reverse :word
  3554. >if emptyp :word [op "]
  3555. >op (word last :word reverse bl :word
  3556. >end
  3557. reverse defined
  3558. ?reflect "skywalker
  3559. reklawyks
  3560. ?reflect [wherever you go]
  3561. go you wherever
  3562.  
  3563.  
  3564. load
  3565. ----
  3566.  
  3567. Action:
  3568. Reads  the  input-named  Dr. Logo file from the  disk  into  the
  3569. workspace.
  3570.  
  3571. Syntax:
  3572. load fname
  3573.  
  3574. Explanation:
  3575. load  reads the contents of the input-named Dr. Logo  file  from
  3576. disk  into the workspace. You can precede the file name  with  a
  3577. drive specifier if the file is not on the default drive.
  3578.  
  3579. Dr.  Logo defines each procedure and variable as it is  read  in
  3580. from the disk. If a procedure in the workspace has the same name
  3581. as  a  procedure  read in from the disk, the  procedure  in  the
  3582. workspace is overwritten.
  3583.  
  3584. load can load only those files saved with a save command  (files
  3585. with the file type LOG in the disk directory). You can load only
  3586. one file at a time. When you interrupt load with Ctrl-G or Ctrl-
  3587. Z,  load stops reading from the Dr. Logo file, and defines  only
  3588. those procedures displayed on your screen.
  3589.  
  3590. Examples:
  3591. These examples assume you have a Dr. Logo file named piglatin on
  3592. the disk in your default drive, and a file named fly on the disk
  3593. in drive B:.
  3594.  
  3595. ?load "piglatin
  3596. begin.vowelp defined
  3597. pig defined
  3598. piglatin defined
  3599. ?load "b:fly
  3600. fly defined
  3601. buzz defined
  3602. zoom defined
  3603.  
  3604.  
  3605. loadpic
  3606. -------
  3607.  
  3608. Action:
  3609. Reads the input-named image file from the disk into the screen.
  3610.  
  3611. Syntax:
  3612. loadpic fname
  3613.  
  3614. Explanation:
  3615. loadpic  reads the contents of the input-named image  file  from
  3616. disk into the screen. You can precede the file name with a drive
  3617. specifier if the file is not on the default drive.
  3618.  
  3619. loadpic  can load only those files saved with a savepic  command
  3620. (files  with the file type PIC in the disk directory).  You  can
  3621. load only one file at a time.
  3622.  
  3623. Examples:
  3624. ?loadpic "ketchum
  3625.  
  3626.  
  3627. local
  3628. -----
  3629.  
  3630. Action:
  3631. Makes the input-named variable(s) accessible only to the current
  3632. procedure and the procedures it calls.
  3633.  
  3634. Syntax:
  3635. local var_name (...)
  3636.  
  3637. Explanation:
  3638. local  makes the input-named variables "local" to the  procedure
  3639. in  which  the local expression occurs. Local variables  can  be
  3640. changed  by the procedure in which the local expression  occurs,
  3641. or by any procedure it calls.
  3642.  
  3643. Without punctuation, local requires and accepts one input  name.
  3644. local  can  accept  more  inputs  when  you  enclose  the  local
  3645. expression in parentheses ["(" and ")"]. If no other expressions
  3646. follow the local expression on the line, you do not need to type
  3647. the closing right parenthesis [")"].
  3648.  
  3649. Most frequently, you will use variables of the same name  within
  3650. calling  and called procedures, to pass information between  the
  3651. two  procedures. However, you will also find applications  where
  3652. you  do  not  want the called procedure to  modify  the  calling
  3653. procedure's  value  of  the  variable.  If  calling  and  called
  3654. procedures  are  using  variables of the  same  name,  which  is
  3655. unavoidably  the  case when a procedure calls  itself,  a  local
  3656. expression in the called procedure prevents the called procedure
  3657. from altering the calling procedure's value of the variable.
  3658.  
  3659. Examples:
  3660. drawing.report  and  drawcircle  both use x and  y  as  variable
  3661. names.  The local expression in drawcircle  prevents  drawcircle
  3662. from  modifying drawing.report's values of x and y. Without  the
  3663. local  expression  in  drawcircle,  drawing.report  would  print
  3664. circle.finished at the point where the turtle began drawing  the
  3665. circle.
  3666.  
  3667. ?to drawing.report
  3668. >make "x (-150)
  3669. >make "y 80
  3670. >pu setpos list :x :y
  3671. >tt "drawing.circle
  3672. >drawcircle
  3673. >setpos list :x :y
  3674. >tt "circle.finished seth 0 fd 10
  3675. >end
  3676. drawing.report defined
  3677. ?to drawcircle
  3678. >(local "x "y)
  3679. >make "x 10
  3680. >make "y 50
  3681. >pu setpos list :x :y seth 90
  3682. >pd repeat 36 [fd 10 rt 10] pu
  3683. >end
  3684. drawcircle defined
  3685. ?drawing.report
  3686.  
  3687. See Colorplate 25. circle.finished (local Primitive)
  3688.  
  3689. The  local statement in decimal.of.fraction forces Dr.  Logo  to
  3690. create    a    new   variable   named    inverse    each    time
  3691. decimal.of.fraction calls itself.
  3692.  
  3693. ?to decimal.of.fraction :n
  3694. >local "inverse
  3695. >make "inverse 1 / :n
  3696. >if :n = 1 [stop]
  3697. >decimal.of.fraction :n - 1
  3698. >(pr ["1/] :n char 9 :inverse
  3699. >end
  3700. decimal.of.fraction defined
  3701. ?decimal.of.fraction 10
  3702. 1/ 2    0.5
  3703. 1/ 3    0.333333333333333
  3704. 1/ 4    0.25
  3705. 1/ 5    0.2
  3706. 1/ 6    0.166666666666667
  3707. 1/ 7    0.142857142857143
  3708. 1/ 8    0.125
  3709. 1/ 9    0.111111111111111
  3710. 1/ 10   0.1
  3711.  
  3712.  
  3713. log
  3714. ---
  3715.  
  3716. Action:
  3717. Outputs the natural logarithm of the input number.
  3718.  
  3719. Syntax:
  3720. log n
  3721.  
  3722. Explanation:
  3723. log outputs the natural logarithm of the input number. A natural
  3724. logarithm  is  the  logarithm  to the  base  <e>,  where  <e>  =
  3725. 2.71828182845905.
  3726.  
  3727. Examples:
  3728. ?log 1
  3729. 0
  3730. ?log (exp 1)
  3731. 1
  3732. ?log (180 / pi)
  3733. 4.04822696504081
  3734.  
  3735.  
  3736. log10
  3737. -----
  3738.  
  3739. Action:
  3740. Outputs the base 10 logarithm of the input number.
  3741.  
  3742. Syntax:
  3743. log10 n
  3744.  
  3745. Explanation:
  3746. log10 outputs the base 10 logarithm of the input number.
  3747.  
  3748. Examples:
  3749. ?log10 100
  3750. 2
  3751. ?log10 734
  3752. 2.86569605991607
  3753. ?log10 3950
  3754. 3.59659709562646
  3755.  
  3756.  
  3757. lowercase lc
  3758. ------------
  3759.  
  3760. Action:
  3761. Outputs  the  input  word  with  all  alphabetic  characters  in
  3762. lowercase.
  3763.  
  3764. Syntax:
  3765. lowercase word
  3766. lc word
  3767.  
  3768. Explanation:
  3769. lowercase outputs the input word with all alphabetic  characters
  3770. converted to lower case.
  3771.  
  3772. Examples:
  3773. ?lowercase "SOUTH
  3774. south
  3775. ?lowercase "MaryAnn
  3776. maryann
  3777. ?to quiz
  3778. >pr [Do you like chocolate chip cookies!
  3779. ?]
  3780. >if "y = lc first rq
  3781. >   [pr [I do too!]]
  3782. >   [pr [Wow, I've never met anyone who !
  3783. didn't!]
  3784. >end
  3785. quiz defined
  3786. ?quiz
  3787. Do you like chocolate chip cookies?
  3788. YES!!
  3789. I do too!
  3790.  
  3791.  
  3792. lpen    (= LightPEN)
  3793. ----
  3794.  
  3795. Action:
  3796. Outputs  a  coordinate list that indicates the position  of  the
  3797. lightpen.
  3798.  
  3799. Syntax:
  3800. lpen
  3801.  
  3802. Explanation:
  3803. lpen  outputs the position where the lightpen first touched  the
  3804. screen  since  the  last lpen expression.  lpen  represents  the
  3805. lightpen's position in the same way cursor represents the cursor
  3806. location on a 40 column text screen. Both lpen and cursor use  a
  3807. coordinate  system that originates at the upper left  corner  of
  3808. the display.
  3809.  
  3810.           [0 0]                           [39 0]
  3811.                 +-----------------------+
  3812.                 |                       |
  3813.                 |                       |
  3814.                 |                       |
  3815.                 |                       |
  3816.                 |                       |
  3817.                 +-----------------------+
  3818.          [0 24]                           [39 24]
  3819.  
  3820. Examples:
  3821. sketch  shows how to use lpenp to determine whether or  not  the
  3822. lightpen  has  been used before trying to  read  the  lightpen's
  3823. position with lpen. If there is no lightpen input waiting to  be
  3824. read  when Dr. Logo executes a lpen expression, lpen outputs  [0
  3825. 0].
  3826.  
  3827. convertx  and  converty  show a way  to  convert  from  lightpen
  3828. coordinates into turtle graphics coordinates.
  3829.  
  3830. ?to sketch
  3831. >fd 2
  3832. >wait 10
  3833. >if lpenp [turnto lpen]
  3834. >sketch
  3835. >end
  3836. sketch defined
  3837. ?to turnto :position
  3838. >convertx converty
  3839. >(pr :position "= list :x :y)
  3840. >setheading towards list :x :y
  3841. >sketch
  3842. >end
  3843. turnto defined
  3844. ?to convertx
  3845. >make "x (first :position) * 7.5 - 150
  3846. >end
  3847. convertx defined
  3848. ?to converty
  3849. >make "y (last :position) * (-8) + 100
  3850. >end
  3851. converty defined
  3852. ?sketch
  3853.  
  3854.  
  3855. lpenp   (= LightPEN Predicate)
  3856. -----
  3857.  
  3858. Action:
  3859. Outputs TRUE if lightpen input is waiting to be read.
  3860.  
  3861. Syntax:
  3862. lpenp
  3863.  
  3864. Explanation:
  3865. lpenp outputs TRUE if lightpen input is waiting to be read.  Use
  3866. lpenp  in  an  if  statement to determine  whether  or  not  the
  3867. lightpen  has  been used before trying to  read  the  lightpen's
  3868. position with lpen (see lpen).
  3869.  
  3870. Examples:
  3871. ?to sketch
  3872. >fd 2
  3873. >wait 10
  3874. >if lpenp [turnto lpen]
  3875. >sketch
  3876. >end
  3877. sketch defined
  3878. ?to turnto :position
  3879. >convertx converty
  3880. >(pr :position "= list :x :y)
  3881. >setheading towards list :x :y
  3882. >sketch
  3883. >end
  3884. turnto defined
  3885. ?to convertx
  3886. >make "x (first :position) * 7.5 - 150
  3887. >end
  3888. convertx defined
  3889. ?to converty
  3890. >make "y (last :position) * (-8) + 100
  3891. >end
  3892. converty defined
  3893. ?sketch
  3894.  
  3895.  
  3896. lput    (= Last PUT)
  3897. ----
  3898.  
  3899. Action:
  3900. Outputs a new object formed by making the first input object the
  3901. last element in the second input object.
  3902.  
  3903. Syntax:
  3904. lput object object
  3905.  
  3906. Explanation:
  3907. lput  outputs  a  new object formed by making  the  first  input
  3908. object  the last element in the second input object.  Generally,
  3909. the  new object is the same kind of object as the  second  input
  3910. object:  a word, number, or list. However, when you lput a  word
  3911. into a number, lput outputs a word.
  3912.  
  3913. Examples:
  3914. ?lput "s "plural
  3915. plurals
  3916. ?lput "s [plural]
  3917. [plural s]
  3918. ?lput "cherries [apples bananas]
  3919. [apples bananas cherries]
  3920. ?lput [San Jose] [[San Diego] [San Fran!
  3921. cisco]]
  3922. [[San Diego] [San Franscico] [San Jose]]
  3923. ?make "extensions [[Hal 33] [John 85]]
  3924. ?to add.entry :item
  3925. >make "extensions lput :item :extensions
  3926. >end
  3927. add.entry defined
  3928. ?add.entry [Steve 96]
  3929. ?:extensions
  3930. [[Hal 33] [John 85] [Steve 96]]
  3931.  
  3932.  
  3933. make
  3934. ----
  3935.  
  3936. Action:
  3937. Makes the input object the value of the input-named variable.
  3938.  
  3939. Syntax:
  3940. make varname object
  3941.  
  3942. Explanation:
  3943. make  makes  the  input object the "contents" or  value  of  the
  3944. input-named  variable.  If  the input-named  variable  does  not
  3945. exist,  make  creates it. If the  input-named  variable  already
  3946. exists,  make  discards its current contents and  gives  it  the
  3947. input object as a value.
  3948.  
  3949. make  works just like name, except that the order of the  inputs
  3950. are reversed. make works by adding the system property .APV with
  3951. the  value  of the input object to  the  input-named  variable's
  3952. property list.
  3953.  
  3954. Examples:
  3955. ?make "flavor "chocolate
  3956. ?:flavor
  3957. chocolate
  3958. ?make "chocolate "semi\-sweet
  3959. ?:chocolate
  3960. semi-sweet
  3961. ?thing "flavor
  3962. chocolate
  3963. ?thing :flavor
  3964. semi-sweet
  3965. ?to say.hello
  3966. >pr [Hello!  What's your name?]
  3967. >make "answer readquote
  3968. >(pr [Nice to meet you,] word :answer ".
  3969. >end
  3970. say.hello defined
  3971. ?say.hello
  3972. Hello!  What's your name?
  3973. Oscar
  3974. Nice to meet you, Oscar.
  3975.  
  3976.  
  3977. memberp         (= MEMBER Predicate)
  3978. -------
  3979.  
  3980. Action:
  3981. Outputs  TRUE  if the first input object is an  element  of  the
  3982. second input object.
  3983.  
  3984. Syntax:
  3985. memberp object object
  3986.  
  3987. Explanation:
  3988. memberp outputs TRUE if the first input object is an element  of
  3989. the second input object; otherwise, memberp outputs FALSE.
  3990.  
  3991. Examples:
  3992. ?memberp "y "only
  3993. TRUE
  3994. ?memberp 7 734395
  3995. TRUE
  3996. ?memberp "or "chore
  3997. TRUE
  3998. ?memberp "chocolate [[vanilla][chocolat!
  3999. e][strawberry]]
  4000. FALSE
  4001. ?memberp [chocolate] [[vanilla][chocola!
  4002. te][strawberry]]
  4003. TRUE
  4004. ?to vowelp :object
  4005. >if memberp :object [a e i o u]
  4006. >   [op "TRUE]
  4007. >   [op "FALSE]
  4008. >end
  4009. vowelp defined
  4010. ?vowelp "c
  4011. FALSE
  4012. ?vowelp "i
  4013. TRUE
  4014.  
  4015.  
  4016. mouse
  4017. -----
  4018.  
  4019. Action:
  4020. Outputs a list giving the state of the mouse.
  4021.  
  4022. Syntax:
  4023. mouse
  4024.  
  4025. Explanation:
  4026. Outputs a list giving the state of the mouse.
  4027.  
  4028. Examples:
  4029. ?mouse
  4030. [-160 100 FALSE FALSE FALSE]
  4031.  
  4032. where:
  4033.  
  4034.         the first item (-160) is the mouse x coordinate
  4035.         the second item (100) is the mouse y coordinate
  4036.         the third  item (FALSE) is the mouse left  button
  4037.         the fourth item (FALSE) is the mouse right button
  4038.         the  fifth   item (FALSE) is a predicate saying  if  the
  4039. mouse is inside the graphic window
  4040.  
  4041. (The above mouse list was gotten from text screen.)
  4042.  
  4043.  
  4044. name
  4045. ----
  4046.  
  4047. Action:
  4048. Makes the input object the value of the input-named variable.
  4049.  
  4050. Syntax:
  4051. name object var_name
  4052.  
  4053. Explanation:
  4054. name  makes  the  input object the "contents" or  value  of  the
  4055. input-named  variable.  If  the input-named  variable  does  not
  4056. exist,  name  creates it. If the  input-named  variable  already
  4057. exists,  name  discards its current contents and  gives  it  the
  4058. input object as a value.
  4059.  
  4060. name  works just like make, except that the order of the  inputs
  4061. are reversed. name works by adding the system property .APV with
  4062. the  value  of the input object to  the  input-named  variable's
  4063. property list.
  4064.  
  4065. Examples:
  4066. ?make "chocolate "flavor
  4067. ?:flavor
  4068. chocolate
  4069. ?make "semi\-sweet "chocolate
  4070. ?:chocolate
  4071. semi-sweet
  4072. ?thing "flavor
  4073. chocolate
  4074. ?thing :flavor
  4075. semi-sweet
  4076.  
  4077.  
  4078. namep   (= NAME Predicate)
  4079. -----
  4080.  
  4081. Action:
  4082. Outputs TRUE if the input word identifies a defined variable.
  4083.  
  4084. Syntax:
  4085. namep word
  4086.  
  4087. Explanation:
  4088. namep  outputs  TRUE  if the input  word  identifies  a  defined
  4089. variable. Otherwise, namep outputs FALSE.
  4090.  
  4091. Examples:
  4092. ?make "flavor "chocolate
  4093. ?:flavor
  4094. chocolate
  4095. ?namep "flavor
  4096. TRUE
  4097. ?namep "raspberry
  4098. FALSE
  4099. ?to decrement :name
  4100. >if not namep :name [pr [Not a variable!
  4101. >if numberp thing :name [make :name (th!
  4102. ing :name) - 1]
  4103. >end
  4104. decrement defined
  4105. ?make "age 14
  4106. ?decrement "age
  4107. ?:age
  4108. 13
  4109.  
  4110.  
  4111. nodes
  4112. -----
  4113.  
  4114. Action:
  4115. Outputs the number of free nodes in the workspace.
  4116.  
  4117. Syntax:
  4118. nodes
  4119.  
  4120. Explanation:
  4121. nodes outputs the number of free nodes in the workspace. A  node
  4122. is equal to five bytes.
  4123.  
  4124. Examples:
  4125. ?nodes
  4126. 2684
  4127. ?recycle
  4128. ?nodes
  4129. 3030
  4130.  
  4131.  
  4132. noformat
  4133. --------
  4134.  
  4135. Action:
  4136. Removes comments from the workspace.
  4137.  
  4138. Syntax:
  4139. noformat
  4140.  
  4141. Explanation:
  4142. noformat  removes  comments  from the workspace,  to  free  more
  4143. nodes. noformat works by removing any .FMT property pairs from a
  4144. procedure's poperty list.
  4145.  
  4146. Examples:
  4147. ?to bg.cycle :val  ; Displays backgroun!
  4148. d colors
  4149. >if :val = 0 [pr [Cycle complete.] setb!
  4150. g 1]
  4151. >setbg :val
  4152. >(pr [This is background color number] !
  4153. bg)
  4154. >wait 100  ; Delay to view color
  4155. >bg.cycle :val - 1
  4156. >end
  4157. bg.cycle defined
  4158. ?noformat
  4159. ?po "bg.cycle :val
  4160. bg.cycle :val
  4161. if :val = 0 [pr [Cycle complete.] setbg!
  4162. 1]
  4163. setbg :val
  4164. (pr [This is background color number] b!
  4165. g)
  4166. wait 100
  4167. bg.cycle :val - 1
  4168. end
  4169.  
  4170.  
  4171. not
  4172. ---
  4173.  
  4174. Action:
  4175. Outputs  TRUE  if the input predicate outputs  FALSE,  FALSE  if
  4176. input predicate outputs TRUE.
  4177.  
  4178. Syntax:
  4179. not pred_exp
  4180.  
  4181. Explanation:
  4182. not  reverses the value of a predicate expression. If the  input
  4183. predicate  outputs  TRUE,  not  outputs  FALSE.  If  the   input
  4184. predicate outputs FALSE, not outputs TRUE.
  4185.  
  4186. Examples:
  4187. ?not 2 > 1
  4188. FALSE
  4189. ?not 2 < 1
  4190. TRUE
  4191. ?to inverse :n
  4192. >if not numberp :n [(pr :n [is not a num!
  4193. ber.]) stop]
  4194. >(pr "1\/ :n "= 1 / :n
  4195. >end
  4196. inverse defined
  4197. ?inverse 5
  4198. 1/ 5 = 0.2
  4199. ?inverse "five
  4200. five is not a number.
  4201.  
  4202.  
  4203. notrace
  4204. -------
  4205.  
  4206. Action:
  4207. Turns off trace monitoring of all or specified procedure(s).
  4208.  
  4209. Syntax:
  4210. notrace <procname | procname_list>
  4211.  
  4212. Explanation:
  4213. notrace   turns  off  the  monitoring  of  procedure   execution
  4214. initiated by a trace command.
  4215.  
  4216. Examples:
  4217. ?to average :numbers
  4218. >make "total 0
  4219. >addup :numbers
  4220. >pr :total / count :numbers
  4221. >end
  4222. average defined
  4223. ?to addup :list
  4224. >if emptyp :list [stop]
  4225. >make "total :total + first :list
  4226. >addup bf :list
  4227. >end
  4228. addup defined
  4229. ?trace
  4230. ?average [1 2 3]
  4231. [1] Evaluating average
  4232. [1] numbers is [1 2 3]
  4233. [2] Evaluating addup
  4234. [2] list is [1 2 3]
  4235. [3] Evaluating addup
  4236. [3] list is [2 3]
  4237. [4] Evaluating addup
  4238. [4] list is [3]
  4239. [5] Evaluating addup
  4240. [5] list is []
  4241. 2
  4242. ?notrace
  4243. ?average [1 2 3]
  4244. 2
  4245.  
  4246.  
  4247. nowatch
  4248. -------
  4249.  
  4250. Action:
  4251. Turns off watch monitoring of all or specified procedure(s).
  4252.  
  4253. Syntax:
  4254. nowatch <procname | procname_list>
  4255.  
  4256. Explanation:
  4257. nowatch   turns  off  the  monitoring  of  procedure   execution
  4258. initiated by a watch command.
  4259.  
  4260. Examples:
  4261. ?to average :numbers
  4262. >make "total 0
  4263. >addup :numbers
  4264. >pr :total / count :numbers
  4265. >end
  4266. average defined
  4267. ?to addup :list
  4268. >if emptyp :list [stop]
  4269. >make "total :total + first :list
  4270. >addup bf :list
  4271. >end
  4272. addup defined
  4273. ?watch
  4274. ?average [1 2 3]
  4275. [1] In average, make "total 0
  4276. [1] In average, addup :numbers
  4277. [2] In addup, if emptyp :list [stop]
  4278. [2] In addup, make "total :total + firs!
  4279. t :list
  4280. [2] In addup, addup bf :list
  4281. [3] In addup, if emptyp :list [stop]
  4282. [3] In addup, make "total :total + firs!
  4283. t :list
  4284. [3] In addup, addup bf :list
  4285. [4] In addup, if emptyp :list [stop]
  4286. [4] In addup, make "total :total + firs!
  4287. t :list
  4288. [4] In addup, addup bf :list
  4289. [5] In addup, if emptyp :list [stop]
  4290. [5] In average, pr :total / count :numb!
  4291. ers
  4292. 2
  4293. ?nowatch
  4294. ?average [1 2 3]
  4295. 2
  4296.  
  4297.  
  4298. numberp         (= NUMBER Predicate)
  4299. -------
  4300.  
  4301. Action:
  4302. Outputs TRUE if the input object is a number.
  4303.  
  4304. Syntax:
  4305. numberp object
  4306.  
  4307. Explanation:
  4308. numberp outputs TRUE if the input object is a number; otherwise,
  4309. numberp outputs FALSE.
  4310.  
  4311. Examples:
  4312. ?numberp 374.926
  4313. TRUE
  4314. ?numberp "six
  4315. FALSE
  4316. ?numberp first [2 4 6 8]
  4317. TRUE
  4318. ?numberp butfirst [2 4 6 8]
  4319. FALSE
  4320. ?to inverse :n
  4321. >if not numberp :n [(pr :n [is not a num!
  4322. ber.]) stop]
  4323. >(pr "1\/ :n "= 1 / :n
  4324. >end
  4325. inverse defined
  4326. ?inverse 2
  4327. 1/ 2 = 0.5
  4328. ?inverse "two
  4329. two is not a number.
  4330.  
  4331.  
  4332. open
  4333. ----
  4334.  
  4335. Action:
  4336. Open a file or device.
  4337.  
  4338. Syntax:
  4339. open <fname | device>
  4340.  
  4341. Explanation:
  4342. Open the file or device to send or receive characters. open must
  4343. be used before accessing data in a file.
  4344.  
  4345. Examples:
  4346. ?open "letters
  4347.  
  4348.  
  4349. or
  4350. --
  4351.  
  4352. Action:
  4353. Outputs FALSE if all input predicates outputs FALSE.
  4354.  
  4355. Syntax:
  4356. or pred_exp pred_exp (...)
  4357.  
  4358. Explanation:
  4359. or  outputs FALSE if all input predicates output FALSE.  If  any
  4360. input predicate outputs FALSE, or outputs TRUE.
  4361.  
  4362. Without punctuation, or requires and accepts two input  objects.
  4363. or  can  accept  more or fewer inputs when you  enclose  the  or
  4364. expression in parentheses ["(" and ")"]. If no other expressions
  4365. follow  the or expression on the line, you do not need  to  type
  4366. the closing right parenthesis [")"].
  4367.  
  4368. Examples:
  4369. ?or "TRUE "TRUE
  4370. TRUE
  4371. ?or "TRUE "FALSE
  4372. TRUE
  4373. ?or "FALSE "FALSE
  4374. FALSE
  4375. ?(or "FALSE "FALSE "FALSE "TRUE
  4376. TRUE
  4377. ?to weather
  4378. >pr [What's the temperature today?]
  4379. >make "answer readquote
  4380. >if or (:answer < 50) (:answer > 80)
  4381. >   [pr [Hmm, sounds uncomfortable!]]
  4382. >   [pr [Sounds nice!]]
  4383. >end
  4384. weather defined
  4385. ?weather
  4386. What's the temperature today?
  4387. 92
  4388. Hmm, sounds uncomfortable!
  4389. ?weather
  4390. What's the temperature today?
  4391. 78
  4392. Sounds nice!
  4393.  
  4394.  
  4395.  .out
  4396.  ----
  4397.  
  4398. Action:
  4399. Sends number to I/O port.
  4400.  
  4401. Syntax:
  4402.  .out port_n n
  4403.  
  4404. Explanation:
  4405. Assigns  the  input number (a byte value) to the  specified  I/O
  4406. port.  Port numbers range from 0 through 65535.  THIS  PRIMITIVE
  4407. SHOULD BE USED WITH CAUTION!
  4408.  
  4409. Examples:
  4410. ?.out 10 33
  4411.  
  4412.  
  4413. output op
  4414. ---------
  4415.  
  4416. Action:
  4417. Makes the input object the output of the procedure.
  4418.  
  4419. Syntax:
  4420. output object
  4421. op object
  4422.  
  4423. Explanation:
  4424. output  makes  the input object the output  of  your  procedure.
  4425. Therefore,  output is valid only within a procedure. As soon  as
  4426. your  procedure  outputs an object, control returns  to  calling
  4427. procedure or toplevel.
  4428.  
  4429. Examples:
  4430. ?to Aurora
  4431. >op [Briar Rose]
  4432. >end
  4433. Aurora defined
  4434. ?pr se [Sleeping Beauty's name is] Auro!
  4435. ra
  4436. Sleeping Beauty's name is Briar Rose
  4437. ?to vowelp :object
  4438. >output memberp :object [a e i o u]
  4439. >end
  4440. vowelp defined
  4441. ?vowelp "r
  4442. FALSE
  4443. ?vowelp "e
  4444. TRUE
  4445. ?to coin
  4446. >output first shuffle [heads tails]
  4447. >end
  4448. coin defined
  4449. ?repeat 3 [show coin]
  4450. heads
  4451. heads
  4452. tails
  4453. ?to addup :list
  4454. >if emptyp :list [op 0]
  4455. >op (addup bf :list) + (first :list)
  4456. >end
  4457. addup defined
  4458. ?addup [7 6 -2]
  4459. 11
  4460.  
  4461.  
  4462. package
  4463. -------
  4464.  
  4465. Action:
  4466. Puts the input-named objects into the input-named package.
  4467.  
  4468. Syntax:
  4469. package pkgname name | name list
  4470.  
  4471. Explanation:
  4472. package  puts the input-named procedures and variables into  the
  4473. package  identified  by the input package name. If  the  package
  4474. does  not  exist,  package creates it. If  the  package  already
  4475. exists, package adds the input-named objects to the package. You
  4476. can enter either a single procedure or variable name, or a  list
  4477. of procedure and variable names as the second input to package.
  4478.  
  4479. A  procedure or variable can be in only one package at  a  time,
  4480. but it is easy to move an object from one package to another.  A
  4481. procedure  or  variable resides in the package to which  it  was
  4482. most recently assigned with a package command.
  4483.  
  4484. package  works  by  adding  to or  changing  properties  in  the
  4485. property  lists  of  the named objects. package  adds  the  .PKG
  4486. property  to  the  package name's property list,  and  the  .PAK
  4487. property to the property list of each input-named object.
  4488.  
  4489. Examples:
  4490. These examples assume you have the following in your  workspace:
  4491. six procedures named draw, circle, square, triangle, addup,  and
  4492. grow;  and  five variables named size, big, small,  medium,  and
  4493. penstate.
  4494.  
  4495. ?pots
  4496. to draw
  4497. to circle :size
  4498. to square :size
  4499. to triangle :size
  4500. to addup :list
  4501. to grow :size
  4502. ?package "shapes [circle square triangl!
  4503. e]
  4504. ?pons
  4505. size is 100
  4506. big is 80
  4507. small is 20
  4508. medium is 40
  4509. penstate is [PENDOWN 1]
  4510. ?package "sizes [big medium small]
  4511. ?popkg
  4512. sizes
  4513.   "medium (VAL)
  4514.   "small (VAL)
  4515.   "big (VAL)
  4516. shapes
  4517.   to square :size
  4518.   to triangle :size
  4519.   to circle :size
  4520. ?package "sizes "grow
  4521. ?popkg
  4522. sizes
  4523.   to grow :size
  4524.   "medium (VAL)
  4525.   "small (VAL)
  4526.   "big (VAL)
  4527. shapes
  4528.   to square :size
  4529.   to triangle :size
  4530.   to circle :size
  4531.  
  4532.  
  4533. paddle
  4534. ------
  4535.  
  4536. Action:
  4537. Outputs  a  number  that represents a  paddle  (joystick)  input
  4538. coordinate.
  4539.  
  4540. Syntax:
  4541. paddle n
  4542.  
  4543. Explanation:
  4544. You can use paddle to read the position of a paddle or joystick.
  4545. Dr.  Logo supports up to two paddles or joysticks. If  your  IBM
  4546. Personal  Computer does not have a paddle or joystick  when  Dr.
  4547. Logo encounters a paddle command, paddle returns 0. The range of
  4548. values that paddle outputs depends on your particular paddle  or
  4549. joystick.
  4550.  
  4551. The  number you input to paddle tells Dr. Logo which  coordinate
  4552. you want paddle to output. The input number must be in the range
  4553. 0 to 3:
  4554.  
  4555.         paddle 0 outputs the x coordinate of paddle1
  4556.         paddle 1 outputs the y coordinate of paddle1
  4557.  
  4558.         paddle 2 outputs the x coordinate of paddle2
  4559.         paddle 3 outputs the y coordinate of paddle2
  4560.  
  4561. where  paddle1 is the first paddle or joystick, and  paddle2  is
  4562. the second paddle or joystick.
  4563.  
  4564. Examples:
  4565. draw allows the user to guide the turtle with the joystick. draw
  4566. contains calculations that convert x and y coordinates  returned
  4567. by  paddle into turte coordinates. paddle returns  a  190-number
  4568. range for the x coordinate of this particular joystick, and 144-
  4569. number  range for the y coordinate. amount smooths the  turtle's
  4570. response to the joystick's commands.
  4571.  
  4572. ?to draw
  4573. >repeat 10000
  4574. >   [make "xin paddle 0
  4575. >   make "yin paddle 1
  4576. >   make "xin int ((:xin * (300 / 190)) !
  4577. - 150)
  4578. >   make "yin int ((:yin * (-200 / 144))!
  4579. + 90)
  4580. >   setheading towards list :xin :yin
  4581. >   fd (amount * 0.1)
  4582. >   if buttonp 0 [stop]
  4583. >   if buttonp 1 [clean]
  4584. >end
  4585. draw defined
  4586. ?to amount
  4587. >op int sqrt
  4588. >   ((abs :xin) * (abs :xin) +
  4589. >   ((abs :yin) * (abs :yin)))
  4590. >end
  4591. amount defined
  4592. ?draw
  4593.  
  4594.  
  4595. pal     (= PALette of colors?)
  4596. ---
  4597.  
  4598. Action:
  4599. Not documented!
  4600.  
  4601. Syntax:
  4602. Not documented!
  4603.  
  4604. Explanation:
  4605. Not documented!
  4606.  
  4607. Examples:
  4608. Not documented!
  4609.  
  4610.  
  4611. pause
  4612. -----
  4613.  
  4614. Action:
  4615. Suspends  the  execution  of the  current  procedure,  to  allow
  4616. interaction with the interpreter or editor.
  4617.  
  4618. Syntax:
  4619. pause
  4620.  
  4621. Explanation:
  4622. pause suspends the execution of the current procedure, and  lets
  4623. you  interact  with the interpreter or  editor.  Therefore,  the
  4624. pause  command is valid only within a procedure. When  Dr.  Logo
  4625. encounters  a  pause  command,  it  suspends  execution  of  the
  4626. procedure,  displays a "Pausing..." message, and allows  you  to
  4627. interact with the interpreter. To end the pause, enter co.
  4628.  
  4629. pause  is  one of the three ways you can cause a  pause  in  the
  4630. execution of your procedure.
  4631.  
  4632. A pause expression causes a "breakpoint" in your procedure.  For
  4633. example,  you  can  insert  a  pause  command  just  before   an
  4634. expression  that has been regularly causing an error.  When  you
  4635. execute  the procedure, Dr. Logo will pause before  the  problem
  4636. expression.  During  the pause, you can experiment  by  entering
  4637. variations  of  the problem expression, and  examine  or  change
  4638. local  variables  whose  values  will  be  discarded  when   the
  4639. procedure  finishes  executing. Enter co to end  the  pause  and
  4640. continue execution.
  4641.  
  4642. Examples:
  4643. ?make "size 100
  4644. ?to nautilus :size
  4645. >if (remainder :size 5) = 0 [pause]
  4646. >repeat 36 [fd :sie rt 10]
  4647. >rt 15
  4648. >nautilus :size + 0.5
  4649. >end
  4650. nautilus defined
  4651. ?cs rt 180
  4652. ?nautilus 1
  4653. Pausing... in nautilus: [if [remainder !
  4654. :size 5) = 0 [pause]]
  4655. nautilus ?:size
  4656. 5
  4657. nautilus ?co
  4658. Pausing... in nautilus: [if [remainder !
  4659. :size 5) = 0 [pause]]
  4660. nautilus ?:size
  4661. 5.5
  4662. nautilus ?co
  4663. Pausing... in nautilus: [if [remainder !
  4664. :size 5) = 0 [pause]]
  4665. nautilus ?:size
  4666. 10
  4667. nautilus ?stop
  4668. ?:size
  4669. 100
  4670.  
  4671. See Colorplate 26. nautilus (pause Primitive)
  4672.  
  4673.  
  4674. pendown pd
  4675. ----------
  4676.  
  4677. Action:
  4678. Puts the turtle's pen down; the turtle resumes drawing.
  4679.  
  4680. Syntax:
  4681. pendown
  4682. pd
  4683.  
  4684. Explanation:
  4685. pendown  makes the turtle put its pen down and begin drawing  in
  4686. the current pen color. The pen is down when you start Dr.  Logo.
  4687. Use pendown to resume normal drawing after a penup, penerase, or
  4688. penreverse.
  4689.  
  4690. Examples:
  4691. ?pen
  4692. [PENUP 2]
  4693. ?pendown pen
  4694. [PENDOWN 2]
  4695. ?to halo :size
  4696. >repeat 36 [fd :size * 0.5 pu
  4697. >           fd :size * 0.1 pd
  4698. >           fd :size * 0.2 pu
  4699. >           fd :size * 0.1 pd
  4700. >           fd :size * 0.1 pu
  4701. >           bk :size rt 10 pd]
  4702. >ht
  4703. >end
  4704. halo defined
  4705. ?halo 100
  4706.  
  4707. See Colorplate 29. halo 100 (pendown Primitive)
  4708.  
  4709.  
  4710. penerase pe
  4711. -----------
  4712.  
  4713. Action:
  4714. Puts the turtle's eraser down; turtle erases drawn lines.
  4715.  
  4716. Syntax:
  4717. penerase
  4718. pe
  4719.  
  4720. Explanation:
  4721. penerase  makes the turtle put its eraser down. With the  eraser
  4722. down, the turtle erases any drawn lines it passes over. To  lift
  4723. the eraser, use penup or pendown.
  4724.  
  4725. Examples:
  4726. ?pen
  4727. [PENDOWN 2]
  4728. ?penerase pen
  4729. [PENERASE 2]
  4730. ?to move.triangle
  4731. >cs ht
  4732. >repeat 36 [triangle pe triangle pd set!
  4733. pc 2 rt 10]
  4734. >end
  4735. move.triangle defined
  4736. ?to triangle
  4737. >repeat 3 [fd 40 rt 120]
  4738. >end
  4739. triangle defined
  4740. ?move.triangle
  4741.  
  4742. See Colorplate 30. move.triangle (penerase Primitive)
  4743.  
  4744.  
  4745. penreverse px
  4746. -------------
  4747.  
  4748. Action:
  4749. Makes  turtle erase where lines are drawn, and draw where  there
  4750. are no lines.
  4751.  
  4752. Syntax:
  4753. penreverse
  4754. px
  4755.  
  4756. Explanation:
  4757. penreverse  makes the turtle draw where there are no lines,  and
  4758. erase  where there are lines. To stop using the  reversing  pen,
  4759. enter penup or pendown.
  4760.  
  4761. Examples:
  4762. ?pen
  4763. [PENDOWN 2]
  4764. ?penreverse pen
  4765. [PENREVERSE 2]
  4766. ?to moving.triangle
  4767. >cs ht px
  4768. >repeat 26 [triangle triangle rt 10]
  4769. >end
  4770. moving.triangle defined
  4771. ?to triangle
  4772. >repeat 3 [fd 40 rt 120]
  4773. >end
  4774. triangle defined
  4775. ?moving.triangle
  4776.  
  4777. See Colorplate 30. moving.triangle (penreverse Primitive)
  4778.  
  4779.  
  4780. penup pu
  4781. --------
  4782.  
  4783. Action:
  4784. Picks the turtle's pen up; the turtle stops drawing.
  4785.  
  4786. Syntax:
  4787. penup
  4788. pu
  4789.  
  4790. Explanation:
  4791. penup makes the turtle pick its pen up and stop leaving a  trace
  4792. of its path. Use pendown to resume normal drawing after a  penup
  4793. command.
  4794.  
  4795. Examples:
  4796. ?pen
  4797. [PENDOWN 2]
  4798. ?penup pen
  4799. [PENUP 2]
  4800. ?to halo :size
  4801. >repeat 36 [fd :size * 0.5 pu
  4802. >           fd :size * 0.1 pd
  4803. >           fd :size * 0.2 pu
  4804. >           fd :size * 0.1 pd
  4805. >           fd :size * 0.1 pu
  4806. >           bk :size rt 10 pd]
  4807. >ht
  4808. >end
  4809. halo defined
  4810. ?pd halo 100
  4811.  
  4812. See Colorplate 29. halo 100 (penup Primitive)
  4813.  
  4814.  
  4815. pi
  4816. --
  4817.  
  4818. Action:
  4819. Outputs the value of pi.
  4820.  
  4821. Syntax:
  4822. pi
  4823.  
  4824. Explanation:
  4825. pi outputs the value of pi: 3.14159265358979.
  4826.  
  4827. Examples:
  4828. ?(pr char 227 "= pi
  4829. # = 3.14159265358979
  4830. ?to find.radius :n
  4831. >repeat 180 [fd :n lt 1]
  4832. >make "radius [180 * :n) / (2 * pi)
  4833. >(pr [radius =] :radius
  4834. >lt 90 fd radius
  4835. >end
  4836. find.radius defined
  4837. ?pu sety -90 pd rt 90
  4838. ?find.radius
  4839. radius = 85.9436692696235
  4840.  
  4841. See Colorplate 31. find.radius (pi Primitive)
  4842.  
  4843.  
  4844. piece
  4845. -----
  4846.  
  4847. Action:
  4848. Outputs  an object that contains the specified elements  of  the
  4849. input object.
  4850.  
  4851. Syntax:
  4852. piece n n object
  4853.  
  4854. Explanation:
  4855. piece  outputs  an object made up of the elements of  the  input
  4856. object.  The two input numbers specify which elements are to  be
  4857. included  in  the output object. The range you specify is
  4858. inclusive;  for example, when you specift piece 3 8,  the  third
  4859. and eight elements are included in the output object.
  4860.  
  4861. Examples:
  4862. ?piece 4 7 "Kensington
  4863. sing
  4864. ?piece 2 4 [Nana John Michael Wendy Tin!
  4865. kerbell]
  4866. [John Michael Wendy]
  4867. ?to last.part :name
  4868. >if memberp ". :name
  4869. >   [make "rl where]
  4870. >   [(pr :name [in wrong format.]) stop ]
  4871. >make "r2 count :name
  4872. >op piece (:r1 + 1) :r2 :name
  4873. >end
  4874. last.part defined
  4875. ?last.part "Peter.Pan
  4876. Pan
  4877.  
  4878.  
  4879. pkgall  (= PacKaGe ALL)
  4880. ------
  4881.  
  4882. Action:
  4883. Puts  all  procedures  and variables not in  packages  into  the
  4884. specified package.
  4885.  
  4886. Syntax:
  4887. pkgall pkgname
  4888.  
  4889. Explanation:
  4890. pkgall  assigns  all  procedures and variables  not  already  in
  4891. packages  to  the input-named package. If the package  does  not
  4892. exist, pkgall creates it. If the package does exist, pkgall adds
  4893. the unpackaged procedures and variables to the existing package.
  4894.  
  4895. Examples:
  4896. These  examples  assume  that you have  the  following  in  your
  4897. workspace:  a  buried package named shapes that  contains  three
  4898. procedures named circle, square, and triangle; a buried  package
  4899. named sizes that contains three variables named big, medium, and
  4900. small;  and three unpackaged objects: a variable named  penstate
  4901. and two procedures named draw and grow.
  4902.  
  4903. ?popkg
  4904. shapes is buried
  4905.   to square :size
  4906.   to circle :size
  4907.   to triangle :size
  4908. sizes is buried
  4909.   "medium (VAL)
  4910.   "small (VAL)
  4911.   "big (VAL)
  4912. ?pots
  4913. to grow :size
  4914. to draw
  4915. ?pons
  4916. penstate is [PENDOWN 2]
  4917. ?pkgall "other
  4918. ?popkg
  4919. other
  4920.   to grow :size
  4921.   to draw
  4922.   "penstate (VAL)
  4923. shapes is buried
  4924.   to square :size
  4925.   to circle :size
  4926.   to triangle :size
  4927. sizes is buried
  4928.   "medium (VAL)
  4929.   "small (VAL)
  4930.   "big (VAL)
  4931.  
  4932.  
  4933. plist   (= Property LIST)
  4934. -----
  4935.  
  4936. Action:
  4937. Outputs the property list of the input-named object.
  4938.  
  4939. Syntax:
  4940. plist name
  4941.  
  4942. Explanation:
  4943. plist  outputs  the  property list of  the  input-named  object.
  4944. Section  5,  "Property Lists, Workspace, and  Disks",  describes
  4945. property  lists,  and defines the properties Dr. Logo  gives  to
  4946. objects  in  the workspace. To understand  the  examples  below,
  4947. remember that a property list is made up of property pairs.  The
  4948. first  element  of  the pair is the property;  the  second,  its
  4949. value. Dr. Logo gives defined properties the .DEF property,  and
  4950. defined variables the .APV property.
  4951.  
  4952. Examples:
  4953. These  examples  assume you have in your workspace  a  procedure
  4954. named triangle and a variable named star.
  4955.  
  4956. ?plist "triangle
  4957. [.DEF [[size] [repeat 3 [fd :size rt 12!
  4958. 0]]]]
  4959. ?plist "star
  4960. [.APV evening]
  4961. ?to remove :name
  4962. >if emptyp plist :name [stop]
  4963. >make "prop first plist :name
  4964. >run (se "remprop "quote :name "quote :!
  4965. prop)
  4966. >remove :name
  4967. >end
  4968. remove defined
  4969. ?make "bird "blue
  4970. ?remove "bird
  4971. ?:bird
  4972. bird has no value
  4973.  
  4974.  
  4975. po      (= Print Out)
  4976. --
  4977.  
  4978. Action:
  4979. Displays the definition(s) of the specified procedure(s).
  4980.  
  4981. Syntax:
  4982. po procname | procname_list
  4983.  
  4984. Explanation:
  4985. po displays the definition of a procedure, or the definitions of
  4986. a  list  of  procedures. When you do not  have  your  procedures
  4987. grouped  in an appropriate package and cannot use pops, you  can
  4988. input a list of procedure names to po to display the definitions
  4989. of a group of procedures.
  4990.  
  4991. Examples:
  4992. ?to triangle :size
  4993. >repeat 3 [fd :size rt 120]
  4994. >end
  4995. triangle defined
  4996. ?to square :size
  4997. >repeat 4[fd :size rt 90]
  4998. >end
  4999. square defined
  5000. ?po "square
  5001. to square :size
  5002. repeat 4 [fd :size rt 90]
  5003. end
  5004. ?po [triangle square]
  5005. to triangle :size
  5006. repeat 3 [fd :size rt 120]
  5007. end
  5008. to square :size
  5009. repeat 4 [fd :size rt 90]
  5010. end
  5011.  
  5012.  
  5013. poall   (= Print Out ALL)
  5014. -----
  5015.  
  5016. Action:
  5017. Displays the definitions of all procedures and variables in  the
  5018. workspace or input-named package(s).
  5019.  
  5020. Syntax:
  5021. poall <pkgname | pkgname_list>
  5022.  
  5023. Explanation:
  5024. Without  an  input,  poall  displays  the  definitions  of   all
  5025. procedures and variables in the workspace. poall with a  package
  5026. name  as  input displays the definitions of all  procedures  and
  5027. variables  in the input-named package. You can input a  list  of
  5028. package  names  to  poall to display  the  contents  of  several
  5029. packages.
  5030.  
  5031. Examples:
  5032. These  examples  assume you have two packages named  shapes  and
  5033. sizes in your workspace.
  5034.  
  5035. ?poall
  5036.  
  5037. poall  displays the definitions of all procedures and  variables
  5038. in the workspace.
  5039.  
  5040. ?poall "shapes
  5041.  
  5042. poall  displays the definitions of all procedures and  variables
  5043. in the package named shapes.
  5044.  
  5045. ?poall [shapes sizes]
  5046.  
  5047. poall  displays the definitions of all procedures and  variables
  5048. in the packages named shapes and sizes.
  5049.  
  5050.  
  5051. pocall  (= Print Out CALLed procedure)
  5052. ------
  5053.  
  5054. Action:
  5055. Displays  the names of the procedures called by the  input-named
  5056. procedure.
  5057.  
  5058. Syntax:
  5059. pocall procname
  5060.  
  5061. Explanation:
  5062. pocall displays the names of the procedures called by the input-
  5063. named  procedure. The name of each called procedure is  indented
  5064. on the line beneath the name of the procedure that calls it. The
  5065. procedure names appear in the order in which they are called.
  5066.  
  5067. Examples:
  5068. ?to wheel
  5069. >repeat 12 [flag lt 30]
  5070. >end
  5071. wheel defined
  5072. ?to tri
  5073. >repeat 3 [rt 120 fd 25]
  5074. >end
  5075. tri defined
  5076. ?to flag
  5077. >fd 50 tri bk 50
  5078. >end
  5079.  
  5080. flag defined
  5081. ?pocall "wheel
  5082. wheel
  5083.   flag
  5084.     tri
  5085. ?to addup :list
  5086. >if emptyp :list [op 0]
  5087. >op (addup bf :list) + (first :list)
  5088. >end
  5089. addup defined
  5090. ?pocall "addup
  5091. addup :list
  5092.   addup :list
  5093.  
  5094.  
  5095. pons    (= Print Out NameS)
  5096. ----
  5097.  
  5098. Action:
  5099. Displays the names and values of all variables in the  workspace
  5100. or specified package(s).
  5101.  
  5102. Syntax:
  5103. pons <pkgname | pkgname_list>
  5104.  
  5105. Explanation:
  5106. Without an input, pons displays the names and values of all  the
  5107. variables  defined  in  the workspace. With a  package  name  as
  5108. input,  pons displays the names and values of all the  variables
  5109. contained  in  the specified package. You can input  a  list  of
  5110. package names to pons to display variable names and values  from
  5111. several packages.
  5112.  
  5113. Examples:
  5114. These examples assume you have the following in your  workspace:
  5115. three variables named big, medium, and small in a package  named
  5116. sizes;  two  variables named bird and snake in a  package  named
  5117. animals; and a variable named penstate.
  5118.  
  5119. ?pons
  5120. medium is 40
  5121. small is 20
  5122. big is 80
  5123. bird is blue
  5124. penstate is [PENDOWN 2]
  5125. snake is green
  5126. ?pons "sizes
  5127. medium is 40
  5128. small is 20
  5129. big is 80
  5130. ?pons [sizes animals]
  5131. medium is 40
  5132. small is 20
  5133. big is 80
  5134. bird is blue
  5135. snake is green
  5136.  
  5137.  
  5138. popkg   (= Print Out PacKaGe)
  5139. -----
  5140.  
  5141. Action:
  5142. Displays the name and contents of each package in the workspace.
  5143.  
  5144. Syntax:
  5145. popkg
  5146.  
  5147. Explanation:
  5148. popkg  displays  the name and contents of each  package  in  ths
  5149. workspace. The names of variables and procedures in the  package
  5150. are  indented under the package name. Variable names are  quoted
  5151. and  are followed by (VAL). Procedure names are preceded by  the
  5152. word "to" and are followed by their inputs, if any. Object names
  5153. that  have  properties are quoted and are  followed  by  (PROP).
  5154. popkg  includes  the names and contents of buried  packages  and
  5155. indicates that the package is buried.
  5156.  
  5157. Examples:
  5158. These examples assume you have four packages named wheel, sizes,
  5159. average, and shapes in your workspace.
  5160.  
  5161. ?popkg
  5162. wheel
  5163.   to wheel
  5164.   to flag
  5165.   to tri
  5166. sizes
  5167.   "big (VAL)
  5168.   "small (VAL)
  5169.   "medium (VAL)
  5170. average
  5171.   to addup :list
  5172.   to average :list
  5173. shapes
  5174.   to circle :size
  5175.   to triangle :size
  5176.   to square :size
  5177. ?bury "average
  5178. ?popkg
  5179. wheel
  5180.   to wheel
  5181.   to flag
  5182.   to tri
  5183. sizes
  5184.   "big (VAL)
  5185.   "small (VAL)
  5186.   "medium (VAL)
  5187. average is buried
  5188.   to addup :list
  5189.   to average :list
  5190. shapes
  5191.   to circle :size
  5192.   to triangle :size
  5193.   to square :size
  5194.  
  5195.  
  5196. pops    (= Print Out ProcedureS)
  5197. ----
  5198.  
  5199. Action:
  5200. Displays  the  names and definitions of all  procedures  in  the
  5201. workspace or specified package(s).
  5202.  
  5203. Syntax:
  5204. pops <pkgname | pkgname_list>
  5205.  
  5206. Explanation:
  5207. Without an input, pops displays the names and definitions of all
  5208. the procedures defined in the workspace. With a package name  as
  5209. input,  pops  displays  the names and  definitions  of  all  the
  5210. procedures  contained in the specified package. You can input  a
  5211. list  of  package names to pops to display procedure  names  and
  5212. definitions from several packages.
  5213.  
  5214. Examples:
  5215. These examples assume you have the following in your  workspace:
  5216. three  procedures named wheel, flag, and tri in a package  named
  5217. wheel; two procedures named average and addup in a package named
  5218. average; and a procedure named square.
  5219.  
  5220. ?pops
  5221. to wheel
  5222. repeat 12 [flag lt 30]
  5223. end
  5224. to square :size
  5225. repeat 4 [fd :size rt 90]
  5226. end
  5227. to tri
  5228. repeat 3 [rt 120 fd 25]
  5229. end
  5230. to flag
  5231. fd 50 tri bk 50
  5232. end
  5233. to addup :list
  5234. if emptyp :list [op 0]
  5235. op (addup bf :list) + (first :list)
  5236. end
  5237. to average :list
  5238. op (addup :list) / (count :list)
  5239. end
  5240. ?pops "wheel
  5241. to wheel
  5242. repeat 12 [flag lt 30]
  5243. end
  5244. to tri
  5245. repeat 3 [rt 120 fd 25]
  5246. end
  5247. to flag
  5248. fd 50 tri bk 50
  5249. end
  5250. ?pops [wheel average]
  5251. to wheel
  5252. repeat 12 [flag lt 30]
  5253. end
  5254. to tri
  5255. repeat 3 [rt 120 fd 25]
  5256. end
  5257. to flag
  5258. fd 50 tri bk 50
  5259. end
  5260. to addup :list
  5261. if emptyp :list [op 0]
  5262. op (addup bf :list) + (first :list)
  5263. end
  5264. to average :list
  5265. op (addup :list) / (count :list)
  5266. end
  5267.  
  5268.  
  5269. poref   (= Print Out REFerenced procedures)
  5270. -----
  5271.  
  5272. Action:
  5273. Displays  the names of the procedures that call the  input-named
  5274. procedure(s).
  5275.  
  5276. Syntax:
  5277. poref procname | procname_list
  5278.  
  5279. Explanation:
  5280. poref displays the names of any procedures that call the  input-
  5281. named  procedure.  You  can  use  poref  to  check  that   other
  5282. procedures  will  be affected when you  change  the  input-named
  5283. procedure.
  5284.  
  5285. Examples:
  5286. ?to wheel
  5287. >repeat 12 [flag lt 30]
  5288. >end
  5289. wheel defined
  5290. ?to tri
  5291. >repeat 3 [rt 120 fd 25]
  5292. >end
  5293. tri defined
  5294. ?to flag
  5295. >fd 50 tri bk 50
  5296. >end
  5297. flag defined
  5298. ?poref "tri
  5299. to flag
  5300. ?poref "flag
  5301. to wheel
  5302. ?to addup :list
  5303. >if emptyp :list [op 0]
  5304. >op (addup bf :list) + (first :list)
  5305. >end
  5306. addup defined
  5307. ?to average :list
  5308. >op (addup :list) / (count :list)
  5309. >end
  5310. average defined
  5311. ?poref "addup
  5312. to average :list
  5313. to addup :list
  5314.  
  5315.  
  5316. pos
  5317. ---
  5318.  
  5319. Action:
  5320. Outputs  a  list that contains the coordinates of  the  turtle's
  5321. current position.
  5322.  
  5323. Syntax:
  5324. pos
  5325.  
  5326. Explanation:
  5327. pos  outputs  a two-element list that  identifies  the  turtle's
  5328. current  position. The format of the list is suitable for  input
  5329. to  setpos.  When the turtle is plotting on  screen,  the  first
  5330. element  of  the list is the x coordinate in the range  -150  to
  5331. +149, and the second element is the y coordinate in the range  -
  5332. 99 to +100. When the turtle is off the screen, either the x or y
  5333. coordinate or both will be greater than the visible range.
  5334.  
  5335. Examples:
  5336. ?cs pos
  5337. [0 0]
  5338. ?to save.place
  5339. >make "place pos
  5340. >end
  5341. save.place defined
  5342. ?to return
  5343. >setpos :place
  5344. >end
  5345. return defined
  5346. ?setpos list (random 150) (random 100)
  5347. ?pos
  5348. [90 22]
  5349. ?save.place
  5350. ?setpos list (random 150) (random 100)
  5351. ?pos
  5352. [55 73]
  5353. ?return
  5354.  
  5355. See  Colorplate 32, return (pos Primitive), and  Colorplate  33,
  5356. find.center (pos Primitive).
  5357.  
  5358. ?to find.center :n
  5359. >repeat 180 [fd :n lt 2]
  5360. >make "radius (180 * :n) (2 * pi)
  5361. >lt 90 fd :radius
  5362. >show pos
  5363. >end
  5364. find.center defined
  5365. ?pu back 80 rt 90 bk 90 pd
  5366. ?find.center 2
  5367. [-89.9891 -22.6934]
  5368.  
  5369.  
  5370. potl    (= Print Out Top Level procedures)
  5371. ----
  5372.  
  5373. Action:
  5374. Displays the names of the procedures that are not called by  any
  5375. other procedures in the workspace.
  5376.  
  5377. Syntax:
  5378. potl
  5379.  
  5380. Explanation:
  5381. potl displays the names of toplevel procedures, procedures  that
  5382. are not called by any other procedures in the workspace, and are
  5383. executed  only by direct command at the interpreter's ?  prompt.
  5384. Use  potl  to  discover which procedures  do  not  affect  other
  5385. procedures,  or  which procedure names are good  candidates  for
  5386. subsequent pocall command.
  5387.  
  5388. Examples:
  5389. ?to wheel
  5390. >repeat 12 [flag lt 30]
  5391. >end
  5392. wheel defined
  5393. ?to tri
  5394. >repeat 3 [rt 120 fd 25]
  5395. >end
  5396. tri defined
  5397. ?to flag
  5398. >fd 50 tri bk 50
  5399. >end
  5400. flag defined
  5401. ?to addup :list
  5402. >if emptyp :list [op 0]
  5403. >op (addup bf :list) + (first :list)
  5404. >end
  5405. addup defined
  5406. ?to average :list
  5407. >op (addup :list) / (count :list)
  5408. >end
  5409. average defined
  5410. ?potl
  5411. to wheel
  5412. to average :list
  5413.  
  5414.  
  5415. pots    (= Print Out TitleS)
  5416. ----
  5417.  
  5418. Action:
  5419. Displays the names and inputs of all procedures in the workspace
  5420. or specified package(s).
  5421.  
  5422. Syntax:
  5423. pots <pkgname | pkgname_list>
  5424.  
  5425. Explanation:
  5426. Without an input, pots displays the names and inputs of all  the
  5427. unburied  procedures  in the workspace. With a package  name  as
  5428. input, pots prints the names and inputs of all the procedures in
  5429. the package, even if the package is buried. You can input a list
  5430. of  package  names to pots to display the names  and  inputs  of
  5431. procedure in several packages.
  5432.  
  5433. Examples:
  5434. This  example assumes you have the following in your  workspace:
  5435. three  procedures named wheel, flag, and tri in a package  named
  5436. wheel; two procedures named average and addup in a package named
  5437. average;   and  three  procedures  named  square,  circle,   and
  5438. triangle.
  5439.  
  5440. ?pots
  5441. to wheel
  5442. to tri
  5443. to square :size
  5444. to flag
  5445. to addup :list
  5446. to average :list
  5447. to circle :size
  5448. to triangle :size
  5449. ?pots "average
  5450. to addup :list
  5451. to average :list
  5452. ?pots [average wheel]
  5453. to wheel
  5454. to flag
  5455. to tri
  5456. to addup :list
  5457. to average :list
  5458.  
  5459.  
  5460. pprop   (= Put PROperty Pair)
  5461. -----
  5462.  
  5463. Action:
  5464. Puts  the  input  property pair into  the  input-named  object's
  5465. property list.
  5466.  
  5467. Syntax:
  5468. pprop name prop object
  5469.  
  5470. Explanation:
  5471. pprop  puts  a  property  pair  into  the  input-named  object's
  5472.  
  5473. property  list.  pprop requires three inputs: the  name  of  the
  5474. object  to  which the property is to be added, the name  of  the
  5475. property,  and  the  object  that is to  be  the  value  of  the
  5476. property. pprop makes the input property pair the first pair  in
  5477. the input-named object's property list.
  5478.  
  5479. You can use pprop to add standard Dr. Logo system properties  to
  5480. a  property list. For example, if you use pprop to add the  .APV
  5481. property to an object's property list, you create a variable the
  5482. same as if you had used name or make.
  5483.  
  5484. You  must  use  pprop to add your own special  properties  to  a
  5485. property list. However, the erasing commands (erase, ern, erall,
  5486. erps, and erns) remove only standard Dr. Logo system  properties
  5487. from  property  lists. This means that, if you have  assigned  a
  5488. nonstandard  property to an object's property list, that  object
  5489. will  still  be in the workspace after an  erall  commmand.  Use
  5490. remprop to remove your special properties from a property list.
  5491.  
  5492. Examples:
  5493. ?pprop "dungeonmaster ".APV "Scott
  5494. ?:dungeonmaster
  5495. Scott
  5496. ?to make.character :name
  5497. >make "abilities [strength intelligence !
  5498. wisdom dexterity constitution charisma]
  5499. >make "other [class hitpoints armorclass!
  5500.  alignment level experience goldpieces]
  5501. >assign :abilities
  5502. >assign :other
  5503. >(pr [You have given] :name [the followi!
  5504. ng characteristics:]
  5505. >pr plist :name
  5506. >end
  5507. make.character defined
  5508. ?to assign :list
  5509. >if emptyp :list [stop]
  5510. >print word first :list "?
  5511. >make "value readlist
  5512. >pprop :name first :list :value
  5513. >assign butfirst :list
  5514. >end
  5515. assign defined
  5516. ?make.character "Borg
  5517. Strength?
  5518. 17
  5519. Intelligence?
  5520. 8
  5521. (...)
  5522. You have given Borg the following chara!
  5523. cteristics:  goldpieces [10] experience!
  5524. [0] level [1] alignment [lawful] armorc!
  5525. lass [3] hitpoints [6] class [fighter] !
  5526. charisma [6] constitution [15] dexterit!
  5527. y [7] wisdom [10] intelligence [8] stre!
  5528. ngth [17]
  5529.  
  5530.  
  5531. pps     (= Property PairS)
  5532. ---
  5533.  
  5534. Action:
  5535. Displays  the  nonsystem property pairs of all  objects  in  the
  5536. workspace or specified packages.
  5537.  
  5538. Syntax:
  5539. pps <pkgname | pkgname_list>
  5540.  
  5541. Explanation:
  5542. Without an input, pps prints out the special property pairs  you
  5543. have  assigned  with  a  pprop command  to  any  object  in  the
  5544. workspace. If you have not assigned any special properties,  pps
  5545. prints  nothing.  With a package name as input, pps  prints  the
  5546. special  property pairs from the specified package, even if  the
  5547. package is buried. You can input a list of package names to  pps
  5548. to  display  the  names  and inputs  of  procedures  in  several
  5549. packages.
  5550.  
  5551. Examples:
  5552. ?pprop "Kathy "extension 82
  5553. ?pps
  5554. Kathy's extension is 82
  5555.  
  5556.  
  5557. prec
  5558. ----
  5559.  
  5560. Action:
  5561. Outputs the number of significant digits.
  5562.  
  5563. Syntax:
  5564. prec
  5565.  
  5566. Explanation:
  5567. Outputs the number of significant digits displayed in an  output
  5568. number.
  5569.  
  5570. Examples:
  5571. ?prec
  5572. 6
  5573.  
  5574.  
  5575. primitivep      (= PRIMITIVE Predicate)
  5576. ----------
  5577.  
  5578. Action:
  5579. Outputs TRUE if the input object is a primitive name.
  5580.  
  5581. Syntax:
  5582. primitivep object
  5583.  
  5584. Explanation:
  5585. primitivep outputs TREU if the input object is a primitive name;
  5586. otherwise, primitivep outputs FALSE.
  5587.  
  5588. Examples:
  5589. ?primitivep "phone
  5590. FALSE
  5591. ?primitivep "home
  5592. TRUE
  5593.  
  5594.  
  5595. print pr
  5596. --------
  5597.  
  5598. Action:
  5599. Displays the input object(s) on the text screen.
  5600.  
  5601. Syntax:
  5602. print object (...)
  5603. pr object (...)
  5604.  
  5605. Explanation:
  5606. print  displays  the input object on the screen, followed  by  a
  5607. Carriage  Return. print removes the outer square  brackets  ("["
  5608. and  "]") from an input list. Compare print with type and  show.
  5609. You  can  input any number of objects by preceding them  with  a
  5610. left  parenthesis  ["("]. When preceded by a  left  parenthesis,
  5611. print displays all its inputs on the same line, and follows only
  5612. the last input with a Carriage Return.
  5613.  
  5614. Examples:
  5615. ?print [This is a message.]
  5616. This is a message.
  5617. ?make "variable "silly
  5618. ?(pr [This is a] :variable "message.)
  5619. This is a silly message.
  5620.  
  5621.  
  5622. proclist        (= PROCedure LIST)
  5623. --------
  5624.  
  5625. Action:
  5626. Outputs   a  list  that  contains  the  names  of  all   defined
  5627. procedures.
  5628.  
  5629. Syntax:
  5630. proclist
  5631.  
  5632. Explanation:
  5633. proclist  outputs  a  list  that  contains  the  names  of   all
  5634. procedures currently defined in the workspace.
  5635.  
  5636. Examples:
  5637. This  example assumes you have the following procedures in  your
  5638. workspace: wheel, flag, tri, addup, and average.
  5639.  
  5640. ?pots
  5641. to wheel
  5642. to flag
  5643. to tri
  5644. to addup
  5645. to average
  5646. ?proclist
  5647. [wheel flag tri addup average]
  5648. ?package "current proclist
  5649. ?popkg
  5650. current
  5651.   to wheel
  5652.   to flag
  5653.   to tri
  5654.   to addup :list
  5655.   to average :list
  5656.  
  5657.  
  5658. product *
  5659. ---------
  5660.  
  5661. Action:
  5662. Outputs the product of the input numbers.
  5663.  
  5664. Syntax:
  5665. product n n (...)
  5666.  
  5667. Explanation:
  5668. product  outputs  the product of the input numbers.  product  is
  5669. equivalent to the * arithmetic operator.
  5670.  
  5671. Without  punctuation,  product requires and  accepts  two  input
  5672. objects.  product  can  accept more or  fewer  inputs  when  you
  5673. enclose the product expression in parentheses ["(" and ")"].  If
  5674. no other expressions follow the product expression on the  line,
  5675. you do not need to type the closing right parenthesis [")"].
  5676.  
  5677. Examples:
  5678. ?product 7 6
  5679. 42
  5680. ?(product 2 pi 5)
  5681. 31.4159265358979
  5682. ?(product 7)
  5683. 7
  5684. ?to cube :n
  5685. >op (product :n :n :n)
  5686. >end
  5687. cube defined
  5688. ?cube 3
  5689. 27
  5690.  
  5691.  
  5692. quotient
  5693. --------
  5694.  
  5695. Action:
  5696. Outputs the quotient of the two input numbers.
  5697.  
  5698. Syntax:
  5699. quotient n n
  5700.  
  5701. Explanation:
  5702. quotient  outputs the number that results when the  first  input
  5703. number  is divided by the second. quotient truncates  any  input
  5704. decimal  number  to an integer. Unlike the /  operator,  if  the
  5705. result ends in a decimal fraction, quotient truncates the result
  5706. to an integer.
  5707.  
  5708. Examples:
  5709. ?quotient 10 4
  5710. 2
  5711. ?10/4
  5712. 2.5
  5713. ?quotient -10 5
  5714. -2
  5715. ?quotient 5 0
  5716. Can't divide by zero
  5717. ?quotient 5 .9
  5718. Can't divide by zero
  5719.  
  5720.  
  5721. radians
  5722. -------
  5723.  
  5724. Action:
  5725. Outputs the number of radians in the input number of degrees.
  5726.  
  5727. Syntax:
  5728. radians degrees_n
  5729.  
  5730. Explanation:
  5731. radians  outputs  the number of radians in the input  number  of
  5732. degrees, where degrees = radians * (180 / pi).
  5733.  
  5734. Examples:
  5735. ?radians 90
  5736. 1.5707963267949
  5737. ?radians 180
  5738. 3.14159265358979
  5739. ?pi
  5740. 3.14159265358979
  5741. ?radians 450
  5742. 7.85398163397449
  5743.  
  5744.  
  5745. random
  5746. ------
  5747.  
  5748. Action:
  5749. Outputs  a  random  non-negative integer  less  than  the  input
  5750. number.
  5751.  
  5752. Syntax:
  5753. random n
  5754.  
  5755. Explanation:
  5756. random outputs a random non-negative integer less than the input
  5757. number. This means random might output any integer from zero  to
  5758. one  less  than  the input number. For example,  random  2  will
  5759. output either 0 or 1.
  5760.  
  5761. Examples:
  5762. ?random 10
  5763. 4
  5764. ?repeat 20 [(type random 10 char 9)]
  5765. 3   0    2    3    1    4    6    4    !
  5766. 4   7    9    4    5    1    8    2    !
  5767. ?to drawspinner :n
  5768. >if (:n > 330) [stop]
  5769. >pu rt 15 fd 25
  5770. >tt (word (int (:n / 36)))
  5771. >bk 25 rt 21 fd 25 pd fd 5 pu bk 30
  5772. >drawspinner :n + 36
  5773. >end
  5774. drawspinner defined
  5775. ?to spin
  5776. >repeat 72 * random 6 [rt 5]
  5777. >repeat random 45 [rt 5]
  5778. >pr int (heading / 36)
  5779. >end
  5780. spin defined
  5781. ?drawspinner 0
  5782. ?spin
  5783. 1
  5784.  
  5785. See Colorplate 34. spin (random Primitive)
  5786.  
  5787.  
  5788. readchar rc
  5789. -----------
  5790.  
  5791. Action:
  5792. Outputs the first character typed at the keyboard.
  5793.  
  5794. Syntax:
  5795. readchar
  5796. rc
  5797.  
  5798. Explanation:
  5799. readchar  outputs  the first character typed  at  the  keyboard.
  5800. readchar  can  output  any character  you  can  type,  including
  5801. control  characters,  except  Ctrl-G and  Ctrl-Z.  Ctrl-G  stops
  5802. execution  and returns to toplevel; Ctrl-Z enters a  pause  (see
  5803. co).
  5804.  
  5805. During  a  procedure's  execution, readchar does  not  move  the
  5806. cursor  or  display  the input character on the  screen.  If  no
  5807. character  is waiting to be read, reachar waits until  you  type
  5808. something.  If  something  is  waiting  to  be  read,   readchar
  5809. immediately outputs the first character in the keyboard  buffer.
  5810. The  description  of keyp tells how to check if a  character  is
  5811. waiting to be read.
  5812.  
  5813. Examples:
  5814. ?readchar
  5815. z
  5816. ?to quiz
  5817. >pr [Do you know any Martians?]
  5818. >if "y = lowercase readchar
  5819. >   [pr [Takes one to know one!]]
  5820. >   [pr [Me either!]]
  5821. >end
  5822. quiz defined
  5823. ?quiz
  5824. Do you know any Martians? y
  5825. Takes one to know one!
  5826. ?to poly.cycle :n
  5827. >(pr [Press any key to draw a] :n [side!
  5828. d figure.])
  5829. >sink rc cs
  5830. >repeat :n [fd 40 rt (360 / :n)]
  5831. >if :n > 8 [stop]
  5832. >poly.cycle :n + 1
  5833. >end
  5834. poly.cycle defined
  5835. ?to sink :object
  5836. >end
  5837. sink defined
  5838. ?poly.cycle 3
  5839. Press any key to draw a 3 sided figure.
  5840. Press any key to draw a 4 sided figure.
  5841. Press any key to draw a 5 sided figure.
  5842. Press any key to draw a 6 sided figure.
  5843. Press any key to draw a 7 sided figure.
  5844. Press any key to draw a 8 sided figure.
  5845. Press any key to draw a 9 sided figure.
  5846.  
  5847. See Colorplate 35. poly.cycle (readchar Primitive)
  5848.  
  5849.  
  5850. readeofp        (= READ End-Of-File Predicate)
  5851. --------
  5852.  
  5853. Action:
  5854. Outputs TRUE if end of data file reached.
  5855.  
  5856. Syntax:
  5857. readeofp
  5858.  
  5859. Explanation:
  5860. Outputs TRUE if the current data file is at the end;  otherwise,
  5861. outputs  FALSE.  You must use open and setread  before  you  use
  5862. readeofp.
  5863.  
  5864. Examples:
  5865. ?open "telnos
  5866. ?setread "telnos
  5867. ?readeopf
  5868. FALSE
  5869.  
  5870.  
  5871. reader
  5872. ------
  5873.  
  5874. Action:
  5875. Outputs current open file name.
  5876.  
  5877. Syntax:
  5878. reader
  5879.  
  5880. Explanation:
  5881. Outputs the current file name that is open for reading.
  5882.  
  5883. Examples:
  5884. ?reader
  5885. [A:BOOKLIST.DAT]
  5886.  
  5887.  
  5888. readlist rl
  5889. -----------
  5890.  
  5891. Action:
  5892. Outputs a list that contains a line typed at the keyboard.
  5893.  
  5894. Syntax:
  5895. readlist
  5896. rl
  5897.  
  5898. Explanation:
  5899. readlist  outputs  a  list that contains a  line  typed  at  the
  5900. keyboard. readlist always displays the input line on the  screen
  5901. before outputting the list.
  5902.  
  5903. readlist  can  read  a line only after you  press  the  Carriage
  5904. Return ("Enter") key. If no line is waiting to be read, readlist
  5905. waits  for  something to be typed. If a line is  waiting  to  be
  5906. read, readlist outputs the line immediately. The description  of
  5907. keypp tells how to check if something is waiting to be read.
  5908.  
  5909. Examples:
  5910. ?readlist
  5911. yippee ti yi yo
  5912. [yippee ti yi yo]
  5913. ?repeat 5 readlist
  5914. fd 40 rt 72
  5915.  
  5916. See Colorplate 36. repeat 5 readlist (readlist Primitive)
  5917.  
  5918. ?to interpret
  5919. >pr [What next, boss?]
  5920. >run readlist
  5921. >interpret
  5922. >end
  5923. interpret defined
  5924. ?to mymessage
  5925. >catch "error [interpret]
  5926. >(pr "Oops, first butfirst error [! ! !!
  5927. ])
  5928. >pr [What do you want to do about that?!
  5929. ]
  5930. >run readlist
  5931. >mymessage
  5932. >end
  5933. mymessage defined
  5934. ?mymessage
  5935. What next, boss?
  5936. fence
  5937. What next, boss?
  5938. fd 200
  5939. Oops, Turtle out of bounds ! ! !
  5940. What do you want to do about that?
  5941. bk 100
  5942. What next, boss?
  5943. to quit
  5944. Oops, I don't know to to ! ! !
  5945. What do you want to do about that?
  5946. stop
  5947.  
  5948. See Colorplate 37. fence fd 200 (readlist Primitive)
  5949.  
  5950.  
  5951. readquote rq
  5952. ------------
  5953.  
  5954. Action:
  5955. Outputs a word that contains a line typed at the keyboard.
  5956.  
  5957. Syntax:
  5958. readquote
  5959. rq
  5960.  
  5961. Explanation:
  5962. readquote  outputs  a  word that contains a line  typed  at  the
  5963. keyboard.  readquote  always  displays the  input  line  on  the
  5964. screen. readquote can read a line only if the line is ended with
  5965. a Carriage Return ("Enter") keystroke.
  5966.  
  5967. If  the  line  contains words  separated  by  spaces,  readquote
  5968. inserts  backslant characters ("\") in front of the  spaces,  so
  5969. that  the spaces are treated as literal characters.  This  makes
  5970. the  line one word. You can see the backslant characters if  you
  5971. load an object created with readquote into the editor.
  5972.  
  5973. When  no  line  is waiting to be  read,  readquote  waits  until
  5974. something  is typed. If a line is waiting to be read,  readquote
  5975. outputs the line immediately. You can use keyp to see if a  line
  5976. is waiting to be read.
  5977.  
  5978. Examples:
  5979. ?readquote
  5980. I don't think we're in Kansas anymore
  5981. I don't think we're in Kansas anymore
  5982. ?fkey 2 readquote
  5983. fd 40 rt 160
  5984. ?fd 40 rt 160 Ctrl-G Enter
  5985. ?fd 40 rt 160 Ctrl-G Enter
  5986. ?fd 40 rt 160 Ctrl-G Enter
  5987. ?fd 40 rt 160 Ctrl-G Enter
  5988. ?fd 40 rt 160 Ctrl-G Enter
  5989. ?fd 40 rt 160 Ctrl-G Enter
  5990. ?fd 40 rt 160 Ctrl-G Enter
  5991. ?fd 40 rt 160 Ctrl-G Enter
  5992. ?fd 40 rt 160 Ctrl-G Enter
  5993.  
  5994.  
  5995. recycle
  5996. -------
  5997.  
  5998. Action:
  5999. Reorganizes the workspace to free as many nodes as possible.
  6000.  
  6001. Syntax:
  6002. recycle
  6003.  
  6004. Explanation:
  6005. recycle reorganizes and cleans up the workspace, freeing as many
  6006. nodes as possible. After recycle, nodes can tell you how much of
  6007. your  workspace is filled with procedures, variables, and  other
  6008. defined objects.
  6009.  
  6010. recycle  works  by  calling  the  garbage  collector.  Dr.  Logo
  6011. automatically  calls  the garbage collector when it  is  needed.
  6012. However, if the timing of one of your procedure is critical, you
  6013. can  run recycle before executing the procedure, to ensure  that
  6014. your  procedure will not be interrupted by an automatic  garbage
  6015. collection.  Section 5, "Property Lists, Workspace, and  Disks",
  6016. describes  the  garbage  collector and how  it  reorganizes  and
  6017. cleans up your workspace.
  6018.  
  6019. Examples:
  6020. ?nodes
  6021. 989
  6022. ?recycle
  6023. ?nodes
  6024. 2379
  6025. ?to spi :side :angle :inc
  6026. >fd :side
  6027. >rt :angle
  6028. >spi :side + :inc :angle :inc
  6029. >end
  6030. spi defined
  6031. ?spi 10 100 2
  6032. I'm out of space in spi: spi :side + :i!
  6033. nc :angle :inc
  6034. !recycle
  6035. ?nodes
  6036. 2380
  6037.  
  6038.  
  6039. remainder
  6040. ---------
  6041.  
  6042. Action:
  6043. Outputs  the  integer remainder obtained when  the  first  input
  6044. number is divided by the second.
  6045.  
  6046. Syntax:
  6047. remainder n n
  6048.  
  6049. Explanation:
  6050. remainder  outputs  the integer that is the  remainder  obtained
  6051. when  the  first  input number is divided by  the  second  input
  6052. number.
  6053.  
  6054. Examples:
  6055. ?remainder 7 2
  6056. 1
  6057. ?to evenp :n
  6058. >if 0 = remainder :n 2 [op "TRUE] [op "!
  6059. FALSE]
  6060. >end
  6061. evenp defined
  6062. ?evenp 11
  6063. FALSE
  6064. ?evenp 6
  6065. TRUE
  6066.  
  6067.  
  6068. remprop         (= REMove PROPerty)
  6069. -------
  6070.  
  6071. Action:
  6072. Removes  the  specified property from the  input-named  object's
  6073. property list.
  6074.  
  6075. Syntax:
  6076. remprop name prop
  6077.  
  6078. Explanation:
  6079. remprop  removes the specified property and its value  from  the
  6080. input-named  object's  property  list. You mys  use  remprop  to
  6081. remove any non-system properties you put in an object's property
  6082. list with pprop. You must remove all properties from an object's
  6083. property   list  to  completely  remove  the  object  from   the
  6084. workspace.
  6085.  
  6086. Examples:
  6087. ?pons
  6088. horse1 is Tinderbox
  6089. horse2 is Muffy
  6090. ?plist "horse1
  6091. [color bay .APV Tinderbox]
  6092. ?ern "horse1
  6093. ?plist "horse1
  6094. [color bay]
  6095. ?remprop "horse1 "color
  6096. ?plist "horse1
  6097. []
  6098. ?plist "horse2
  6099. [color [liver chestnut] class [hunter j!
  6100. umper] .APV Muffy]
  6101. ?to remove :name
  6102. >if emptyp plist :name [stop]
  6103. >make "prop first plist :name
  6104. >run (se "remprop "quote :name "quote :!
  6105. prop)
  6106. >remove :name
  6107. >end
  6108. remove defined
  6109. ?remove "horse2
  6110. ?plist "horse2
  6111. []
  6112.  
  6113.  
  6114. repeat
  6115. ------
  6116.  
  6117. Action:
  6118. Executes the input instruction list the input number of times.
  6119.  
  6120. Syntax:
  6121. repeat n instr_list
  6122.  
  6123. Explanation:
  6124. repeat  executes the input instruction list the input number  of
  6125. times. The input number must be positive. If the input number is
  6126. not an integer, repeat truncates it to an integer.
  6127.  
  6128. If  you  want a procedure to execute continuously, such  as  the
  6129. draw  procedure shown in the description of paddle, you can  use
  6130. repeat   1/0  instead  of  a  recursive  call.  This   minimizes
  6131. interruptions from the garbage collector. We recommend that  you
  6132. use  a recursive call as you write your procedure, so  that  you
  6133. can   take  advantage  of  Dr.  Logo's  line-by-line   debugging
  6134. facilities.  Then,  when your procedure  is  working  correctly,
  6135. remove  the  recursive  call and enclose  the  entire  procedure
  6136. definition within a single line: repeat 1/0 with a lengthy input
  6137. instruction list.
  6138.  
  6139. Examples:
  6140. ?repeat 100 [pr [I will not chew gum in!
  6141. class.]
  6142. I will not chew gum in class.
  6143. I will not chew gum in class.
  6144. I will not chew gum in class.
  6145. I will not chew gum in class.
  6146. I will not chew gum in class.
  6147. I will not chew gum in class.
  6148. (...)
  6149. ?make :sides 3
  6150. ?repeat :sides [fd 40 rt 360 / :sides)]
  6151. ?to spi :side :angle :inc
  6152. >fd :side
  6153. >rt :angle
  6154. >spi :side + :inc :angle :inc
  6155. >end
  6156. spi defined
  6157. ?spi 10 100 2
  6158. I'm out of space in spi: spi :side + :i!
  6159. nc :angle :inc
  6160. !recycle
  6161. ?to repspi :side :angle :inc
  6162. >repeat 200
  6163. >   [fd :side
  6164. >   rt :angle
  6165. >   make "side :side + :inc]
  6166. >end
  6167. repspi defined
  6168. ?repspi 10 100 2
  6169.  
  6170. See Colorplate 38. repspi (repeat Primitive)
  6171.  
  6172.  
  6173.  .replace
  6174.  --------
  6175.  
  6176. Action:
  6177. Replaces the specified item of the list with the object.
  6178.  
  6179. Syntax:
  6180.  .replace item_n varlist object
  6181.  
  6182. Explanation:
  6183. Replaces  the specified item of the list with the  object.  THIS
  6184. PRIMITIVE SHOULD BE USED WITH CAUTION!
  6185.  
  6186. Examples:
  6187. ?make "varlist [A B C D E F]
  6188. ?.replace 4 :varlist [1 2 3]
  6189. ?:varlist
  6190. [A B C [1 2 3] E F]
  6191.  
  6192.  
  6193.  .reptail
  6194.  --------
  6195.  
  6196. Action:
  6197. Replaces all items following the specified item in the list with
  6198. the object.
  6199.  
  6200. Syntax:
  6201.  .reptail item_n varlist object
  6202.  
  6203. Explanation:
  6204. Replaces all items following the specified item in the list with
  6205. the object. THIS PRIMITIVE SHOULD BE USED WITH CAUTION!
  6206.  
  6207. Examples:
  6208. ?make "varlist [A B C D E F]
  6209. ?.reptail 4 :varlist [1 2 3]
  6210. ?:varlist
  6211. [A B C D [1 2 3]]
  6212.  
  6213.  
  6214. rerandom
  6215. --------
  6216.  
  6217. Action:
  6218. Makes  a subsequent random expression reproduce the same  random
  6219. sequence.
  6220.  
  6221. Syntax:
  6222. rerandom
  6223.  
  6224. Explanation:
  6225. rerandom makes a subsequent random expression reproduce the same
  6226. random sequence.
  6227.  
  6228. Examples:
  6229. ?repeat 10 [(type random 10 char 9)] pr!
  6230. []
  6231. 2   3   7   5   3   2   0   4   2   6
  6232. ?repeat 10 [(type random 10 char 9)] pr!
  6233. []
  6234. 8   9   9   1   0   6   1   3   5   1
  6235. ?rerandom
  6236. ?repeat 10 [(type random 10 char 9)] pr!
  6237. []
  6238. 6   2   9   0   3   1   6   2   3   7
  6239. ?rerandom
  6240. ?repeat 10 [(type random 10 char 9)] pr!
  6241. []
  6242. 6   2   9   0   3   1   6   2   3   7
  6243.  
  6244.  
  6245. right rt
  6246. --------
  6247.  
  6248. Action:
  6249. Rotates the turtle the input number of degrees to the right.
  6250.  
  6251. Syntax:
  6252. right degrees_n
  6253. rt degrees_n
  6254.  
  6255. Explanation:
  6256. right  rotates  the turtle the input number of  degrees  to  the
  6257. right. Usually, you input a number of degrees between 0 and 359.
  6258. If  the input number is greater than 359, the turtle appears  to
  6259. move  the  input number minus 360 degrees to the right.  If  you
  6260. input a negative number to right, the turtle turns to the left.
  6261.  
  6262. Examples:
  6263. ?repeat 36 [right 10]
  6264. ?repeat 36 [right -10]
  6265. ?to around :s
  6266. >repeat 360 [fd :s rt 10 make "s :s + .!
  6267. 01]
  6268. >end
  6269. around defined
  6270. ?around 2
  6271.  
  6272. See Colorplate 39. around (right Primitive)
  6273.  
  6274.  
  6275. round
  6276. -----
  6277.  
  6278. Action:
  6279. Outputs the input number rounded off to the nearest integer.
  6280.  
  6281. Syntax:
  6282. round n
  6283.  
  6284. Explanation:
  6285. round  outputs  the  input number rounded  off  to  the  nearest
  6286. integer. If the fractional portion of the input number is 0.5 or
  6287. greater,  round  rounds up to the next integer.  To  truncate  a
  6288. decimal number to an integer, use int.
  6289.  
  6290. Examples:
  6291. ?round 3.333333
  6292. 3
  6293. ?int 28753/12
  6294. 2149
  6295. ?round -75.482
  6296. -75
  6297. ?round 0.5
  6298. 1
  6299.  
  6300.  
  6301. run
  6302. ---
  6303.  
  6304. Action:
  6305. Executes the input instruction list.
  6306.  
  6307. Syntax:
  6308. run instr_list
  6309.  
  6310. Explanation:
  6311. run  executes  the input instruction list. If the  input  object
  6312. outputs an object, run outputs that object. You can use list  or
  6313. sentence to assemble an instruction list for run to execute.
  6314.  
  6315. Examples:
  6316. ?run [print [tricolor]]
  6317. tricolor
  6318. ?run [equalp 0 9]
  6319. FALSE
  6320. ?to use :what
  6321. >if memberp lc :what [green red yellow]
  6322. >   [make "colornumber where
  6323. >   make "state "PENDOWN]
  6324. >if "eraser = lc :what [make "state "PE!
  6325. NERASE]
  6326. >run (se "setpen "list "quote :state "q!
  6327. uote :colornumber)
  6328. >end
  6329. use defined
  6330. ?use "green fd 60 rt 120
  6331. ?use "red fd 60 rt 120
  6332. ?use "yellow fd 60 rt 120
  6333.  
  6334. See Colorplate 40. use "yellow fd 60 rt 120 (run Primitive)
  6335.  
  6336. ?to while :condition :instr_list
  6337. >if "TRUE = run :condition
  6338. >   [run :instr_list]
  6339. >   [stop]
  6340. >while :condition :instr_list
  6341. >end
  6342. while defined
  6343. ?make "side 5
  6344. ?while [:side < 50] [fd :side rt 60 mak!
  6345. e "side :side + 2]
  6346.  
  6347.  
  6348. save
  6349. ----
  6350.  
  6351. Action:
  6352. Writes the contents of the workspace or specified package(s)  to
  6353. the input-named disk file.
  6354.  
  6355. Syntax:
  6356. save fname <pkgname | pkgname_list>
  6357.  
  6358. Explanation:
  6359. save   writes  the  contents  of  the  workspace  or   specified
  6360. package(s)  to the input-named disk file. If there is already  a
  6361. file  with  the specified name on the disk,  save  displays  the
  6362. message  "File already exists." Choose another name for the  new
  6363. file,  delete  the old file with erasefile, or  rename  it  with
  6364. changef.  If  there is no file with the specified  name  on  the
  6365. disk, save creates one with the file type LOG. File names in the
  6366. disk's  directory cannot be longer than eight characters, so  if
  6367. you  specify a file name with more than eight  characters,  save
  6368. truncates the file name to eight characters.
  6369.  
  6370. If  you do not specify a package name as input, save  saves  all
  6371. procedures  and variables, except those in buried  packages.  If
  6372. you specify a package or a list of packages, only the procedures
  6373. and variables in the input-named package(s) are saved. save  can
  6374. save  buried  procedures and variables if you specify  a  buried
  6375. package name.
  6376.  
  6377. Examples:
  6378. Thes  examples assume you have three packages named fy,  shapes,
  6379. and sizes in your workspace.
  6380.  
  6381. ?popkg
  6382. fly is buried
  6383.   to buzz
  6384.   to fly
  6385.   to zoom
  6386. shapes
  6387.   to circle :size
  6388.   to triangle :size
  6389.   to square :size
  6390. sizes
  6391.   "big (VAL)
  6392.   "medium (VAL)
  6393.   "small (VAL)
  6394. ?save "Sheila
  6395. ?save "fly "fly
  6396. ?save "shapes [shapes sizes]
  6397. ?dir
  6398. [SHAPES.LOG FLY.LOG SHEILA.LOG]
  6399.  
  6400.  
  6401. savepic
  6402. -------
  6403.  
  6404. Action:
  6405. Writes the picture (on the screen) to the input-named disk file.
  6406.  
  6407. Syntax:
  6408. savepic fname fname
  6409.  
  6410. Explanation:
  6411. savepic  writes  the contents of the screen to  the  input-named
  6412. disk file. If there is already a file with the specified name on
  6413. the  disk, savepic displays the message "File  already  exists."
  6414. Choose  another name for the new file, delete the old file  with
  6415. erasefile,  or rename it with changef. If there is no file  with
  6416. the  specified  name on the disk, savepic creates one  with  the
  6417. file  type  PIC. File names in the disk's  directory  cannot  be
  6418. longer than eight characters, so if you specify a file name with
  6419. more  than  eight characters, save truncates the  file  name  to
  6420. eight characters.
  6421.  
  6422. Examples:
  6423. ?savepic "Sheila
  6424. ?dirpic
  6425. [SHEILA.PIC]
  6426.  
  6427.  
  6428. screenfacts sf
  6429. --------------
  6430.  
  6431. Action:
  6432. Outputs a list that contains information about the screen.
  6433.  
  6434. Syntax:
  6435. screenfacts
  6436. sf
  6437.  
  6438. Explanation:
  6439. Outputs  a  list that contains: Background color number  of  the
  6440. viewport; Screen state; Split size; Window state; Scrunch ratio;
  6441. Zoom  factor; X-coordinate and Y-coordinate of viewport  center;
  6442. Current resolution setting.
  6443.  
  6444. Examples:
  6445. ?screenfacts
  6446. [2 SS 25 WRAP 2 2 100 100 2]
  6447.  
  6448.  
  6449. sentence se
  6450. -----------
  6451.  
  6452. Action:
  6453. Outputs a list made up of the input objects.
  6454.  
  6455. Syntax:
  6456. sentence object object (...)
  6457. se object object (...)
  6458.  
  6459. Explanation:
  6460. sentence  outputs a list made up of the input objects.  sentence
  6461. is  like list but removes the outermost brackets from the  input
  6462. objects.
  6463.  
  6464. Without  punctuation,  sentence requires and accepts  two  input
  6465. objects.  sentence  can  accept more or fewer  inputs  when  you
  6466. enclose the sentence expression in parentheses ["(" and ")"]. If
  6467. no other expressions follow the sentence expression on the line,
  6468. you do not need to type the closing right parenthesis [")"].
  6469.  
  6470. There are two ways of creating lists in Dr. Logo:
  6471.  
  6472.         1) using square bracket ("[" and "]")
  6473.         2) using list or sentence
  6474.  
  6475. Each way results in a different kind of list. When you create  a
  6476. list  by  enclosing elements in square brackets,  you  create  a
  6477. "literal"  list.  Dr.  Logo  treats the  elements  of  the  list
  6478. literally;  it  does  not evaluate expressions or  look  up  the
  6479. values of variables named in a literal list.
  6480.  
  6481. When  you  use list or sentence to create a list,  you  can  use
  6482. variables and expressions to specify the elements Dr. Logo  will
  6483. put in the list. You can use list and sentence to create a  list
  6484. for  input to most procedures. However, if, iffalse, and  iftrue
  6485. require literal lists as input.
  6486.  
  6487. Examples:
  6488. ?sentence "tortoise "hare
  6489. [tortoise hare]
  6490. ?se "turtle []
  6491. [turtle]
  6492. ?make "turtle (se rl rl rl)
  6493. pecans
  6494. caramel
  6495. chocolate
  6496. ?:turtle
  6497. [pecans caramel chocolate]
  6498. ?se "hare [rabbit bunny]
  6499. [hare rabbit bunny]
  6500. ?se [Slow and steady] [wins the race]
  6501. [Slow and steady wins the race.]
  6502. ?to use :what
  6503. >if memberp lc :what [green red yellow]
  6504. >   [make "colornumber where
  6505. >   make "state "PENDOWN]
  6506. >if "eraser = lc :what [make "state "PE!
  6507. NERASE]
  6508. >run (se "setpen "list "quote :state "q!
  6509. uote :colornumber)
  6510. >end
  6511. use defined
  6512. ?use "green fd 60 rt 120
  6513. ?use "red fd 60 rt 120
  6514. ?use "yellow fd 60 rt 120
  6515.  
  6516. See Colorplate 40. use "yellow fd 60 rt 120 (run Primitive)
  6517.  
  6518.  
  6519. setbg           (= SET BackGround)
  6520. -----
  6521.  
  6522. Action:
  6523. Sets  the graphic screen background to the color represented  by
  6524. the input number.
  6525.  
  6526. Syntax:
  6527. setbg n
  6528.  
  6529. Explanation:
  6530. setbg   sets  the  graphic  screen  background  to   the   color
  6531. represented by the input number. The input number must be in the
  6532. range  from  0 to 63. The IBM Personal Computer  supports  eight
  6533. background  colors  in two levels of  intensity,  although  your
  6534. color monitor might or might not display different  intensities.
  6535. The numbers setbg accepts represent colors as follows:
  6536.  
  6537. Low intensity           High intensity
  6538. -----------------       ------------------
  6539. 0 16 32 48  Black        8 24 40 56  Black
  6540. 1 17 33 49  Blue         9 25 41 57  Blue
  6541. 2 18 34 50  Green       10 26 42 58  Green
  6542. 3 19 35 51  Cyan        11 27 42 59  Cyan
  6543. 4 20 36 52  Red         12 28 43 60  Red
  6544. 5 21 37 53  Magenta     13 29 45 61  Magenta
  6545. 6 22 38 54  Yellow      14 30 46 62  Yellow
  6546. 7 23 40 55  White       15 31 47 63  White
  6547.  
  6548. Each  of  the four numbers for a background  color  specifies  a
  6549. different pen for the turtle to use (see pencolor).
  6550.  
  6551. Examples:
  6552. When   you   first  start  Dr.  Logo,  background   returns   1,
  6553. representing  blue, the default background color.  The  bg.cycle
  6554. procedure displays background colors.
  6555.  
  6556. ?bg
  6557. 1
  6558. ?to bg.cycle :val
  6559. >if :val = 0 [pr [Cycle complete.] setb!
  6560. g 1 stop]
  6561. >setbg :val
  6562. >(pr [This is background color number] !
  6563. bg)
  6564. >wait 100
  6565. >bg.cycle :val - 1
  6566. >end
  6567. bg.cycle defined
  6568. ?bg.cycle 8
  6569. This is background color 8
  6570. This is background color 7
  6571. This is background color 6
  6572. This is background color 5
  6573. This is background color 4
  6574. This is background color 3
  6575. This is background color 2
  6576. This is background color 1
  6577. Cycle complete.
  6578.  
  6579.  
  6580. setcursor
  6581. ---------
  6582.  
  6583. Action:
  6584. Positions the cursor at the location specified by the input text
  6585. screen coordinate list.
  6586.  
  6587. Syntax:
  6588. setcursor coord_list
  6589.  
  6590. Explanation:
  6591. setcursor positions the cursor at the location specified in  the
  6592. input text screen coordinate list. A text screen coordinate list
  6593. has  two elements: the first element is the column  number;  the
  6594. second, the line number. The line number must be in the range  0
  6595. to 24. The column number must be in the range 0 to 79.
  6596.  
  6597. If  either  of  your input numbers  exceed  the  allowed  range,
  6598. setcursor  uses the highest allowable value: 24 for line  number
  6599. or 79 for column number. If you are using a splitscreen or other
  6600. 40  column text screen and specify a column number greater  than
  6601. 40,  setcursor  wraps  the cursor to the next  line,  in  effect
  6602. adding 1 to your input line number and subtracting 40 from  your
  6603. input column number.
  6604.  
  6605. Examples:
  6606. ?setcursor [0 0]
  6607. ?to diagtype
  6608. >type rc
  6609. >setcursor list (3 + first cursor) (1 +!
  6610. last cursor)
  6611. >diagtype
  6612. >end
  6613. diagtype defined
  6614. ?ct
  6615. ?diagtype
  6616. H
  6617.  e
  6618.   l
  6619.    l
  6620.     o
  6621.      ,
  6622.  
  6623.        w
  6624.         o
  6625.          r
  6626.           l
  6627.            d
  6628.             !
  6629.  
  6630.  
  6631. setd            (= SET Drive name)
  6632. ----
  6633.  
  6634. Action:
  6635. Makes the specified drive the default drive.
  6636.  
  6637. Syntax:
  6638. setd d:
  6639.  
  6640. Explanation:
  6641. setd  makes  the specified drive your default  drive.  Dr.  Logo
  6642. looks in the directory of the disk in the default drive when you
  6643. do  not  specify a drive name in a disk command  such  as  save,
  6644. load, erasefile, changef, or dir.
  6645.  
  6646. Examples:
  6647. ?setd "b:
  6648. ?defaultd
  6649. B:
  6650. ?setd "a:
  6651. ?defaultd
  6652. A:
  6653.  
  6654.  
  6655. setheading seth
  6656. ---------------
  6657.  
  6658. Action:
  6659. Turns the turtle to the absolute heading specified by the  input
  6660. number of degrees.
  6661.  
  6662. Syntax:
  6663. setheading degrees_n
  6664. seth degrees_n
  6665.  
  6666. Explanation:
  6667. setheading turns the turtle to the absolute heading specified by
  6668. the  input number of degrees. If the input number  is  positive,
  6669. setheading turns the turtle clockwise (right) from North to  the
  6670. input  number  of degrees, regardless of  the  turtle's  current
  6671. heading.  If the input number is negative, setheading turns  the
  6672. turtle counter-clockwise.
  6673.  
  6674. Examples:
  6675. ?setheading 90
  6676. ?setheading 180
  6677. ?setheading -90
  6678. ?to drawcompass :n
  6679. >if :n > 330 [seth 0 stop]
  6680. >pu setheading :n fd 50
  6681. >tt (word :n)
  6682. >bk 50 rt 23 fd 45 pd fd 5 pu bk 50
  6683. >drawcompass :n + 45
  6684. >end
  6685. drawcompass defined
  6686. ?drawcompass 0
  6687.  
  6688. See Colorplate 41. drawcompass 0 (setheading Primitive)
  6689.  
  6690.  
  6691. setpal
  6692. ------
  6693.  
  6694. Action:
  6695. Not documented!
  6696.  
  6697. Syntax:
  6698. Not documented!
  6699.  
  6700. Explanation:
  6701. Not documented!
  6702.  
  6703. Examples:
  6704. Not documented!
  6705.  
  6706.  
  6707. setpan
  6708. ------
  6709.  
  6710. Action:
  6711. Establishes the center point of the viewport.
  6712.  
  6713. Syntax:
  6714. setpan coord_list
  6715.  
  6716. Explanation:
  6717. Establishes the center point of the viewport.
  6718.  
  6719. Examples:
  6720. ?setpan [50 50]
  6721.  
  6722.  
  6723. setpc           (= SET Pen Color)
  6724. -----
  6725.  
  6726. Action:
  6727. Sets  the  turtle's  pen to the color  specified  by  the  input
  6728. number.
  6729.  
  6730. Syntax:
  6731. setpc n
  6732.  
  6733. Explanation:
  6734. setpc sets the turtle's pen to the color specified by the  input
  6735. number.  The  turtle's has four pens. Each pen has  four  unique
  6736. colors  of  ink, one of which is the background color  that  the
  6737. turtle  uses for erasing. Which pen and set of inks  the  turtle
  6738. uses  depends  on the number you input to setbg to  specify  the
  6739. background color.
  6740.  
  6741. When the background color is in the range 0 to 15:
  6742.  
  6743.         - pencolor 1 represents dark green ink
  6744.         - epncolor 2 represents dark red ink
  6745.         - pencolor 3 represents dark yellow ink
  6746.  
  6747. When the background color is in the range 16 to 31:
  6748.  
  6749.         - pencolor 1 represents bright green ink
  6750.         - pencolor 2 represents bright red ink
  6751.         - pencolor 3 represents bright yellow ink
  6752.  
  6753. When the background color is in the range 32 to 47:
  6754.  
  6755.         - pencolor 1 represents dark cyan ink
  6756.         - pencolor 2 represents dark magenta ink
  6757.         - pencolor 3 represents dark grey ink
  6758.  
  6759. When the background color is in the range 48 to 63:
  6760.  
  6761.         - pencolor 1 represents bright cyan ink
  6762.         - pencolor 2 represents bright magenta ink
  6763.         - pencolor 3 represents bright white ink
  6764.  
  6765. For   all  background  color  numbers,  pencolor  0   represents
  6766. background color (erasing) ink. The turtle itself is drawn  with
  6767. pencolor 3.
  6768.  
  6769. Examples:
  6770. ?setpc 2 fd 30
  6771. ?cs
  6772. ?to pencolor.cycle :penc :bkgr
  6773. >if :penc > 3 [change.bg]
  6774. >if :bkgr > 50 [stop]
  6775. >setpc :penc
  6776. >(pr [This is pencolor] pc)
  6777. >repeat 36 [fd 4 rt 10] bk 20
  6778. >pencolor.cycle (:penc + 1) :bkgr
  6779. >end
  6780. pencolor.cycle defined
  6781. ?to change.bg
  6782. >make "bkgr 16 + :bkgr
  6783. >if :bkgr > 50 [stop]
  6784. >setbg :bkgr
  6785. >(pr [Background color] bg)
  6786. >make "penc 1
  6787. >end
  6788. change.bg defined
  6789. ?lt 90 fd 120 clean splitscreen
  6790. ?pencolor.cycle 1 1
  6791. This is pencolor number 1
  6792. This is pencolor number 2
  6793. This is pencolor number 3
  6794. Background color 17
  6795. This is pencolor number 1
  6796. This is pencolor number 2
  6797. This is pencolor number 3
  6798. Background color 33
  6799. This is pencolor number 1
  6800. This is pencolor number 2
  6801. This is pencolor number 3
  6802. Background color 49
  6803. This is pencolor number 1
  6804. This is pencolor number 2
  6805. This is pencolor number 3
  6806.  
  6807. See Colorplate 42. pencolor.cycle 1 1 (setpc Primitive)
  6808.  
  6809.  
  6810. setpen
  6811. ------
  6812.  
  6813. Action:
  6814. Sets  the turtle's pen to the state and color specified  in  the
  6815. input list.
  6816.  
  6817. Syntax:
  6818. setpen list
  6819.  
  6820. Explanation:
  6821. setpen sets the turtle's pen to the state and color specified in
  6822. the input list. You can use setpen to change the pen's state and
  6823. color with a single command; for example, setpen [PENDOWN 2]  is
  6824. equivalent to pendown setpc 2.
  6825.  
  6826. The  first  element of the input list must be  one  of  PENDOWN,
  6827. PENERASE,  PENUP,  or PENREVERSE. The second element must  be  a
  6828. number  that represents a pencolor (see setpc). This input  list
  6829. has same form as the list output from pen.
  6830.  
  6831. Examples:
  6832. ?pen
  6833. [PENDOWN 1]
  6834. ?setpen [PENERASE 0]
  6835. ?pen
  6836. [PENERASE 0]
  6837. ?setpen [PENDOWN 1]
  6838. ?to dandelion
  6839. >setheading first shuffle list
  6840. >   (random 45) (-1 * (random 45))
  6841. >make "penstate pen
  6842. >fd 20 + random 80
  6843. >setpc 1 + random 3
  6844. >repeat 36 [fd 10 bk 10 rt 10]
  6845. >pu setpos :root
  6846. >setpen :penstate
  6847. >dandelion
  6848. >end
  6849. dandelion defined
  6850. ?make "root [0 -50]
  6851. ?setpos :root clean
  6852. ?dandelion
  6853.  
  6854. See Colorplate 27. dandelion (setpen Primitive)
  6855.  
  6856.  
  6857. setpos          (= SET turtle POSition)
  6858. ------
  6859.  
  6860. Action:
  6861. Moves  the  turtle  to  the  position  specified  in  the  input
  6862. coordinate list.
  6863.  
  6864. Syntax:
  6865. setpos coord_list
  6866.  
  6867. Explanation:
  6868. setpos  moves the turtle to the position specified in the  input
  6869. coordinate list. The input list has the same two-element form as
  6870. the list output by pos. The first element is the X coordinate in
  6871. the  range -150 to +149. The second element is the Y  coordinate
  6872. in the range -99 to +100.
  6873.  
  6874. If  the  graphic screen is fenced, values outside  these  ranges
  6875. generate  a "Turtle out of bonds" message. When window  is  set,
  6876. you can input coordinates outside the ranges to make the  turtle
  6877. plot  off  screen. When wrap is set, setpos converts  any  input
  6878. coordinates  that  are outside the visible range,  so  that  the
  6879. turtle "wraps" and remain visible.
  6880.  
  6881. Examples:
  6882. ?clearscreen
  6883. ?setpos [80 50]
  6884. ?setpos [0 30]
  6885. ?setpos [80 -50]
  6886. ?setpos [0 0]
  6887. ?to dandelion
  6888. >setheading first shuffle list
  6889. >   (random 45) (-1 * (random 45))
  6890. >make "penstate pen
  6891. >fd 20 + random 80
  6892. >setpc 1 + random 3
  6893. >repeat 36 [fd 10 bk 10 rt 10]
  6894. >pu setpos :root
  6895. >setpen :penstate
  6896. >dandelion
  6897. >end
  6898. dandelion defined
  6899. ?make "root [0 -50]
  6900. ?setpos :root clean
  6901. ?dandelion
  6902.  
  6903. See Colorplate 27. dandelion (setpen Primitive)
  6904.  
  6905.  
  6906. setprec         (= SET PRECision of numbers)
  6907. -------
  6908.  
  6909. Action:
  6910. Sets  the  number of significant digits displayed in  an  output
  6911. number.
  6912.  
  6913. Syntax:
  6914. setprec n
  6915.  
  6916. Explanation:
  6917. Sets  the  number of siginficant digits displayed in  an  output
  6918. number.
  6919.  
  6920. Examples:
  6921. ?setprec 10
  6922.  
  6923.  
  6924. setread         (= SET file to READ)
  6925. -------
  6926.  
  6927. Action:
  6928. Sets the data file from which to receive input.
  6929.  
  6930. Syntax:
  6931. setread fname
  6932.  
  6933. Explanation:
  6934. Sets  the  data  file from which to receive  input.  After  this
  6935. command,  you use readlist, readchar, and readquote to read  the
  6936. data from the file or device.
  6937.  
  6938. Examples:
  6939. ?open "telnos
  6940. ?setread "telnos
  6941. ?readlist
  6942. [TERRY CLOTH]
  6943.  
  6944.  
  6945. setres          (= SET the RESolution of the screen)
  6946. ------
  6947.  
  6948. Action:
  6949. Sets the resolution of the viewport.
  6950.  
  6951. Syntax:
  6952. setres n
  6953.  
  6954. Explanation:
  6955. Sets the resolution of the viewport. Available resolutions are 0
  6956. (high), 1 (medium), and 2 (low -- only on the PCjr). Changes the
  6957. default  and  maximum  values for many of  the  parameters  that
  6958. affect the appearance of your text and graphic displays.
  6959.  
  6960. Examples:
  6961. ?setres 1
  6962.  
  6963.  
  6964.  .setseg
  6965.  -------
  6966.  
  6967. Action:
  6968. Sets segment value.
  6969.  
  6970. Syntax:
  6971.  .setseg segment_n
  6972.  
  6973. Explanation:
  6974. Sets  segment  value  to  be used  by  subsequent  .deposit  and
  6975.  
  6976. Examples:
  6977. ?.setseg 23
  6978.  
  6979.  
  6980. setscrunch      (= SET SCRUNCH ratio)
  6981. ----------
  6982.  
  6983. Action:
  6984. Sets the viewport vertical aspect ratio.
  6985.  
  6986. Syntax:
  6987. setscrunch n
  6988.  
  6989. Explanation:
  6990. Sets the viewport vertical aspect ratio to the input number that
  6991. can be from 1 through 5.
  6992.  
  6993. Examples:
  6994. ?setscrunch 5
  6995.  
  6996.  
  6997. setsplit
  6998. --------
  6999.  
  7000. Action:
  7001. Sets the number of lines in the splitscreen's text window.
  7002.  
  7003. Syntax:
  7004. setsplit n
  7005.  
  7006. Explanation:
  7007. setsplit  sets  the number of lines in  the  splitscreen  screen
  7008. window. The input number must be in the range 0 to 25.
  7009.  
  7010. Examples:
  7011. ?repeat 12 [repeat 5 [fd 50 rt 72] rt 3!
  7012. 0]
  7013. ?setpc 1
  7014. ?splitscreen
  7015. ?setsplit 15
  7016. ?setsplit 1
  7017. ?setsplit 5
  7018.  
  7019. See Colorplate 43. setsplit 15 (setsplit Primitive)
  7020.  
  7021.  
  7022. setwrite        (= SET file to WRITE)
  7023. --------
  7024.  
  7025. Action:
  7026. Sets the destination of outputs.
  7027.  
  7028. Syntax:
  7029. setwrite fname | device
  7030.  
  7031. Explanation:
  7032. Sets  the destination of outputs from print, type, and  show  to
  7033. the data file or system device. The file or device must  already
  7034. be open. setwrite sets the file position at the top of the file.
  7035.  
  7036. Examples:
  7037. ?open "phones
  7038. ?setwrite "phones
  7039.  
  7040.  
  7041. setx    (= SET X-coordinate)
  7042. ----
  7043.  
  7044. Action:
  7045. Moves  the turtle horizontally to the X coordinate specified  by
  7046. the input number.
  7047.  
  7048. Syntax:
  7049. setx n
  7050.  
  7051. Explanation:
  7052. setx moves the turtle horizontally to the X coordinate specified
  7053. by the input number. The Y coordinate is not changed.
  7054.  
  7055. Examples:
  7056. ?to frame
  7057. >pu setpos [-150 100] pd
  7058. >setx 149
  7059. >sety -99
  7060. >setx -150
  7061. >sety 100
  7062. >end
  7063. frame defined
  7064. ?frame
  7065.  
  7066. See Colorplate 44. frame (setx Primitive)
  7067.  
  7068.  
  7069. sety    (= SET Y-coordinate)
  7070. ----
  7071.  
  7072. Action:
  7073. Moves the turtle vertically to the Y coordinate specified by the
  7074. input number.
  7075.  
  7076. Syntax:
  7077. sety n
  7078.  
  7079. Explanation:
  7080. sety  moves the turtle vertically to the Y coordinate  specified
  7081. by the input number. The X coordinate is not changed.
  7082.  
  7083. Examples:
  7084. ?to frame
  7085. >pu setpos [-150 100] pd
  7086. >setx 149
  7087. >sety -99
  7088. >setx -150
  7089. >sety 100
  7090. >end
  7091. frame defined
  7092. ?frame
  7093.  
  7094. See Colorplate 44. frame (setx Primitive)
  7095.  
  7096.  
  7097. setzoom         (= SET ZOOM ratio)
  7098. -------
  7099.  
  7100. Action:
  7101. Sets the screen to show more or less of the picture.
  7102.  
  7103. Syntax:
  7104. setzoom n
  7105.  
  7106. Explanation:
  7107. Causes  the viewport to show a greater or lesser portion of  the
  7108. graphic  plane,  thereby  expanding  or  contracting  subsequent
  7109. turtle  motion.  Doesn't clear the viewport nor  alter  anything
  7110. previously drawn.
  7111.  
  7112. Examples:
  7113. ?setzoom 2
  7114.  
  7115.  
  7116. show
  7117. ----
  7118.  
  7119. Action:
  7120. Displays the input object on the text screen.
  7121.  
  7122. Syntax:
  7123. show object
  7124.  
  7125. Explanation:
  7126. show displays the input object on the text screen, followed by a
  7127. Carriage Return. show does not remove the outer brackets from an
  7128. input list. Compare show with print and type.
  7129.  
  7130. You  can  input any number of objects by preceding show  with  a
  7131. left  parenthesis  ["("]. When preceded by a  parenthesis,  show
  7132. displays  all its inputs on the same line, and follows only  the
  7133. last input with a Carriage Return.
  7134.  
  7135. Dr. Logo's interpreter has an implicit show command. This  means
  7136. that, when you enter an expression that outputs an object to the
  7137. ?  prompt,  Dr.  Logo  shows  the  output  object,  instead   of
  7138. complaining that it does not know what to do with it.
  7139.  
  7140. Examples:
  7141. ?show "K
  7142. K
  7143. ?show [crab scallops clams]
  7144. [crab scallops clams]
  7145. ?3 * 10
  7146. 30
  7147. ?to demo :list
  7148. >make "success "FALSE
  7149. >catch "error [doit]
  7150. >if :success = "TRUE [stop]
  7151. >make "error1 error
  7152. >if 38 = first :error1 [doit] [pr firs!
  7153. t bf :error1]
  7154. >end
  7155. demo defined
  7156. ?to doit
  7157. >type "? pr :list
  7158. >run :list
  7159. >make "success "TRUE
  7160. >end
  7161. doit defined
  7162. ?to doit1
  7163. >show run :list
  7164. >make "success "TRUE
  7165. >end
  7166. ?doit1 defined
  7167. ?to logo.demo
  7168. >pr []
  7169. >pr [Here's how Dr. Logo responds to so!
  7170. me commands:]
  7171. >pr []
  7172. >demo [make "side 80]
  7173. >demo [repeat 4 [fd :side rt 90]]
  7174. >demo [fence]
  7175. >demo [:side]
  7176. >demo [repeat 2 [back :side]]
  7177. >pr []
  7178. >pr [That's all, folks!]
  7179. >pr []
  7180. >end
  7181. logo.demo defined
  7182. ?logo.demo
  7183.  
  7184. Here's how Dr. Logo responds to some commands:
  7185.  
  7186. ?make "side 80
  7187. ?repeat 4 [fd :side rt 90]
  7188. ?fence
  7189. ?:side
  7190. 80
  7191. ?repeat 2 [back :side]
  7192. Turtle out of bonds
  7193.  
  7194. That's all, folks!
  7195.  
  7196. ?
  7197.  
  7198.  
  7199. showturtle st
  7200. -------------
  7201.  
  7202. Action:
  7203. Makes the turtle visible if hidden.
  7204.  
  7205. Syntax:
  7206. showturtle
  7207. st
  7208.  
  7209. Explanation:
  7210. showturtle makes the turtle visible. When invisible, the  turtle
  7211. draws  faster, and does not distract visually from the  drawing.
  7212. To make the turtle invisible, enter hideturtle (ht).
  7213.  
  7214. Examples:
  7215. ?hideturtle
  7216. ?showturtle
  7217. ?to face
  7218. >ht fd 90
  7219. >make "chin pos
  7220. >setpc 3 repeat 36 [fd 6 lt 10]
  7221. >setpc 1 lt 90 pu fd 30 lt 90 fd 20 se!
  7222. th 0 eye
  7223. >seth 90 fd 30 seth 0 eye
  7224. >setpc 2 seth 150 fd 10 seth 180 south
  7225. >setpos :chin seth 0
  7226. >fd 23 lt 5
  7227. >end
  7228. face defined
  7229. ?to eye
  7230. >pd repeat 18 [fd 1 rt 10]
  7231. >rt 100
  7232. >repeat 8 [fd 1.5 lt 6] pu
  7233. >end
  7234. eye defined
  7235. ?to mouth
  7236. >pd repeat 18 [fd 2 rt 10]
  7237. >rt 100
  7238. >repeat 8 [fd 3 lt 6] pu
  7239. >end
  7240. mouth defined
  7241. ?face
  7242. ?showturtle
  7243.  
  7244. See Colorplate 45. showturtle (showturtle Primitive)
  7245.  
  7246.  
  7247. shuffle
  7248. -------
  7249.  
  7250. Action:
  7251. Outputs  a list that contains the elements of the input list  in
  7252. random order.
  7253.  
  7254. Syntax:
  7255. shuffle list
  7256.  
  7257. Explanation:
  7258. shuffle  outputs a list that contains the elements of the  input
  7259. list in random order.
  7260.  
  7261. Examples:
  7262. ?shuffle [a b c d]
  7263. [c b d a]
  7264. ?to pick.a.card
  7265. >op word
  7266. >   first shuffle [A K Q J 10 9 8 7 6 5 !
  7267. 4 3 2]
  7268. >   char first shuffle [3 4 5 6]
  7269. >end
  7270. pick.a.card defined
  7271. ?repeat 4 [(type pick.a.card char 9)]
  7272. 7Heart 7Clubs KDiamond JSpade
  7273.  
  7274. (Nota  Bene: On the IBM PC, the values 3, 4, 5, and  6  generate
  7275. the  symbols of the playing cards. In this ASCII  version,  they
  7276. are, of course, replaced by their names.)
  7277.  
  7278.  
  7279. sin
  7280. ---
  7281.  
  7282. Action:
  7283. Outputs the sine of the input number of degrees.
  7284.  
  7285. Syntax:
  7286. sin degrees_n
  7287.  
  7288. Explanation:
  7289. sin  outputs  the  trigonometric sine of  the  input  number  of
  7290. degrees. sin outputs a decimal number between 0 and 1.
  7291.  
  7292. Examples:
  7293. ?sin 90
  7294. 1
  7295. ?pops
  7296. ?to plot.sine
  7297. >make "val 0
  7298. >make "x -150
  7299. >make "inc (300 / 60)
  7300. >setx 150 setx :x
  7301. >plot :val
  7302. >end
  7303. plot.sine defined
  7304. ?to plot :val
  7305. >if :x > 150 [stop]
  7306. >make "y (90 * (sin :val))  ; 90 makes !
  7307. plot visible
  7308. >setheading towards list :x :y
  7309. >setpos list :x :y
  7310. >make "x :x + :inc
  7311. >make "val :val + 6
  7312. >plot :val
  7313. >end
  7314. plot defined
  7315. ?plot.sine
  7316.  
  7317. See Colorplate 46. plot.sine (sin Primitive)
  7318.  
  7319.  
  7320. sort
  7321. ----
  7322.  
  7323. Action:
  7324. Outputs a list of input words sorted into ascending order.
  7325.  
  7326. Syntax:
  7327. sort list
  7328.  
  7329. Explanation:
  7330. Outputs a list of input words sorted into ascending order.
  7331.  
  7332. Examples:
  7333. ?sort [Z 2 T * A 4]
  7334. [* 2 4 A T Z]
  7335.  
  7336.  
  7337. splitscreen ss
  7338. --------------
  7339.  
  7340. Action:
  7341. Displays a window of text on the graphic screen.
  7342.  
  7343. Syntax:
  7344. splitscreen
  7345. ss
  7346.  
  7347. Explanation:
  7348. splitscreen  displays a window of text on the graphic screen.  A
  7349. splitscreen  command  is equivalent to a Ctrl-S  keystroke.  Use
  7350. setsplit  to  specify the number of lines of text  in  the  text
  7351. window.
  7352.  
  7353. Examples:
  7354. ?cs repeat 12 [repeat 4 [fd 60 rt 90] r!
  7355. t 30
  7356. ?splitscreen
  7357. ?_
  7358. ?repeat 12 [repeat 4 [fd 60 rt 90] rt 3!
  7359. 0]
  7360. ?splitscreen
  7361.  
  7362. See Colorplate 47. splitscreen (splitscreen Primitive)
  7363.  
  7364.  
  7365. sqrt            (= SQuare RooT)
  7366. ----
  7367.  
  7368. Action:
  7369. Outputs the square root of the input number.
  7370.  
  7371. Syntax:
  7372. sqrt n
  7373.  
  7374. Explanation:
  7375. sqrt outputs the square root of the input number.
  7376.  
  7377. Examples:
  7378. ?sqrt 2
  7379. 1.4142135623731
  7380. ?to measure :xypair1 :xypair2
  7381. >make "x1 first :xypair1
  7382. >make "x2 first :xypair2
  7383. >make "xdif :x2 - :x1
  7384. >make "y1 last :xypair1
  7385. >make "y2 last :xypair2
  7386. >make "ydif :y2 - :y1
  7387. >make "xdif2 :xdif * :xdif
  7388. >make "ydif2 :ydif * :ydif
  7389. >op sqrt (:xdif2 + :ydif2)
  7390. >end
  7391. measure defined
  7392. ?make "p1 [-75 -49]
  7393. ?setpos :p1 clean
  7394. ?make "p2 [75 30]
  7395. ?setpos :p2
  7396. ?measure :p1 :p2
  7397. 169.53170794869
  7398. ?make "p3 [50 -90]
  7399. ?setpos :p3
  7400. ?measure :p2 :p3
  7401. 122.576506721313
  7402. ?setpos :p1
  7403. ?measure :p3 :p1
  7404. 131.552270980018
  7405.  
  7406. See Colorplate 48. setpos :p3 (sqrt Primitive)
  7407.  
  7408.  
  7409. stop
  7410. ----
  7411.  
  7412. Action:
  7413. Stops  the  execution of the current procedure, and  returns  to
  7414. toplevel or the calling procedure.
  7415.  
  7416. Syntax:
  7417. stop
  7418.  
  7419. Explanation:
  7420. stop  stops the execution of the current procedure, and  returns
  7421. to the caller. The caller is either the calling procedure or, if
  7422. the procedure name was typed at the ? prompt, toplevel. stop has
  7423. an  effect  only within a procedure. At toplevel,  stop  has  no
  7424. effect; it simply returns to toplevel. Compare stop with  catch,
  7425. throw, output, and end.
  7426.  
  7427. Examples:
  7428. ?to vanish :object
  7429. >if emptyp :object [stop]
  7430. >pr :object
  7431. >vanish bf :object
  7432. >end
  7433. vanish defined
  7434. ?vanish "emperor
  7435. emperor
  7436. mperor
  7437. peror
  7438. eror
  7439. ror
  7440. or
  7441. r
  7442.  
  7443.  
  7444. sum
  7445. ---
  7446.  
  7447. Action:
  7448. Outputs the sum of the input numbers.
  7449.  
  7450. Syntax:
  7451. sum n n (...)
  7452.  
  7453. Explanation:
  7454. sum  outputs the sum of the input numbers. sum is equivalent  to
  7455. the + arithmetic operator. Without punctuation, sum requires and
  7456. accepts  two input objects. sum can accept more or fewer  inputs
  7457. when  you  enclose the sum expression in  parentheses  ["("  and
  7458. ")"].  If no other expressions follow the sum expression on  the
  7459. line,  you  do not need to type the  closing  right  parenthesis
  7460. [")"].
  7461.  
  7462. Examples:
  7463. ?sum 5 9
  7464. 14
  7465. ?2.565 7.9
  7466. 10.465
  7467. ?(sum 6 4 -7 9 3 -2 8
  7468. 21
  7469.  
  7470.  
  7471. tan
  7472. ---
  7473.  
  7474. Action:
  7475. Outputs the tangent of the input angle.
  7476.  
  7477. Syntax:
  7478. tan degrees_n
  7479.  
  7480. Explanation:
  7481. tan  outputs the tangent of the angle represented by  the  input
  7482. number of degrees.
  7483.  
  7484. Examples:
  7485. ?tan 0
  7486. 0
  7487. ?arctan 45
  7488. 1
  7489. ?to plot.tan
  7490. >make "val -pi
  7491. >make "inc pi / 37.5
  7492. >make "x -150
  7493. >setx 150
  7494. >setx :x
  7495. >plot :val
  7496. >end
  7497. plot.tan defined
  7498. ?to plot :val
  7499. >if :x > 150 [stop]
  7500. >fd 1000 * tan :val
  7501. >sety 0
  7502. >setx :x + 4
  7503. >make "x :x + 4
  7504. >make "val :val + :inc
  7505. >plot :val
  7506. >end
  7507. plot defined
  7508. ?plot.tan
  7509.  
  7510. See Colorplate 49. plot.tan (tan Primitive)
  7511.  
  7512.  
  7513. test
  7514. ----
  7515.  
  7516. Action:
  7517. Remembers  whether  the  input predicate is TRUE  or  FALSE  for
  7518. subsequent iffalse and iftrue expressions.
  7519.  
  7520. Syntax:
  7521. test pred_exp
  7522.  
  7523. Explanation:
  7524. test remembers whether the input predicate is TRUE or FALSE  for
  7525. subsequent  iffalse  and iftrue expressions. You can  use  test,
  7526. iffalse,  and  iftrue  instead  of if to  control  the  flow  of
  7527. execution  within  your  procedure when you  need  Dr.  Logo  to
  7528. evaluate expressions after it evaluates a predicate  expression,
  7529. but before it executes the chose instruction list.
  7530.  
  7531. Examples:
  7532. The  coin5 procedure is similar to the coin procedures shown  as
  7533. examples  under  if,  but shows how to use  test,  iffalse,  and
  7534. iftrue.  coin5  evaluates  an expression after  it  evaluates  a
  7535. predicate   expression,  but  before  it  executes  the   chosen
  7536. instruction list.
  7537.  
  7538. ?to coin5
  7539. >test 1 = random 2
  7540. >if 1 = random 1000000 [pr [Landed on e!
  7541. dge!] stop]
  7542. >ift [type "heads]
  7543. >iff [type "tails]
  7544. >pr [\ side up]
  7545. >end
  7546. coin5 defined
  7547.  
  7548.  
  7549. text
  7550. ----
  7551.  
  7552. Action:
  7553. Outputs the definition list of the specified procedure.
  7554.  
  7555. Syntax:
  7556. text procname
  7557.  
  7558. Explanation:
  7559. text outputs the definition list of the specified procedure. The
  7560. format  of the definition list is suitable for input to  define.
  7561. text  works by outputting the value of the system property  .DEF
  7562. from the procedure's property list.
  7563.  
  7564. Examples:
  7565. ?to star  ; Five pointed star
  7566. >repeat 5 [fd 30 lt 217 fd 30 lt 70]
  7567. >end
  7568. star defined
  7569. ?star
  7570. ?package "figures "star
  7571. ?popkg
  7572. figures
  7573.   to star  ; Five pointed star
  7574. ?plist "star
  7575. [.PAK figures PKG TRUE.DEF [[] [repeat !
  7576. 5 [fd 30 lt 217 fd 30 lt 70]]] .FMT [[0!
  7577. ?text "star
  7578. [[] [repeat 5 [fd 30 lt 217 fd 30 lt 70!
  7579. ]]]
  7580.  
  7581.  
  7582. textscreen ts
  7583. -------------
  7584.  
  7585. Action:
  7586. Selects a full text screen.
  7587.  
  7588. Syntax:
  7589. textscreen
  7590. ts
  7591.  
  7592. Explanation:
  7593. textscreen devotes the entire monitor to text. It can return  to
  7594. a full text screen from a full graphic screen or splitscreen. If
  7595. you have a single monitor system, textscreen is equivalent to  a
  7596. Ctrl-T  keystroke.  If  you have a two-monitor  system  (both  a
  7597. monochrome  and  color monitor), textscreen is the only  way  to
  7598. display  the text screen on the color monitor;  Ctrl-T  displays
  7599. the text screen on the monochrome monitor.
  7600.  
  7601. Examples:
  7602. ?repeat 12 [repeat 4 [fd 60 rt 90] rt 3!
  7603. 0]
  7604. ?splitscreen
  7605. ?textscreen
  7606.  
  7607. See Colorplate 50. splitscreen (textscreen Primitive)
  7608.  
  7609.  
  7610. thing
  7611. -----
  7612.  
  7613. Action:
  7614. Outputs the value of the input-named variable.
  7615.  
  7616. Syntax:
  7617. thing varname
  7618.  
  7619. Explanation:
  7620. thing  displays  the  contents  or  value  of  the   input-named
  7621. variable. thing is equivalent to a colon (":") before a variable
  7622. name;  for example, thing "Karen is equivalent to :Karen.  thing
  7623. works  by outputting the value of the system property .APV  from
  7624. the input-named variable's property list.
  7625.  
  7626. Examples:
  7627. ?name "chocolate "flavor
  7628. ?thing "flavor
  7629. chocolate
  7630. ?:flavor
  7631. chocolate
  7632. ?make "chocolate "semi\-sweet
  7633. ?thing "chocolate
  7634. semi-sweet
  7635. ?thing "flavor
  7636. chocolate
  7637. ?thing :flavor
  7638. semi-sweet
  7639.  
  7640.  
  7641. throw
  7642. -----
  7643.  
  7644. Action:
  7645. Executes  the  line identified by the input name in  a  previous
  7646. catch expression.
  7647.  
  7648. Syntax:
  7649. throw name
  7650.  
  7651. Explanation:
  7652. throw  works  with  the catch primitive to  let  your  procedure
  7653. handle  special  conditions. A throw expression  is  valid  only
  7654. within  the scope of a catch command. The description  of  catch
  7655. explains how to use catch and throw.
  7656.  
  7657. catch  and throw each require a name as input. To pair  a  catch
  7658. expression  with a throw expression you must give the catch  and
  7659. throw  expressions the same input name. When a throw command  is
  7660. executed,  Dr. Logo returns to the procedure that  contains  the
  7661. catch  command  identified  by the throw  name.  Dr.  Logo  then
  7662. executes  the  line that follows the catch  command.  throw  can
  7663. accept  the  special word "toplevel to return to  the  ?  prompt
  7664. (compare with stop).
  7665.  
  7666. Examples:
  7667. The  coil procedure asks the user to enter  increasingly  larger
  7668. numbers  as the turtle draws a coil on the screen. If  the  user
  7669. types  a  number that is not bigger than the last  one  entered,
  7670. coil reminds the user what to type, and continues working.
  7671.  
  7672. ?to coil
  7673. >pr [Enter a small number.]
  7674. >make "previous 0
  7675. >fd grownumber
  7676. >rt 30
  7677. >trap
  7678. >end
  7679. coil defined
  7680. ?to grownumber
  7681. >make "growth first readlist
  7682. >if :growth < :previous [throw "notbigg!
  7683. er]
  7684. >make "previous :growth
  7685. >output :growth
  7686. >end
  7687. grownumber defined
  7688. ?to trap
  7689. >catch "notbigger [drawcoil]
  7690. >(pr [Enter a number bigger than] :prev!
  7691. ious)
  7692. >trap
  7693. >end
  7694. trap defined
  7695. ?to drawcoil
  7696. >pr [Enter a bigger number.]
  7697. >fd grownumber
  7698. >rt 30
  7699. >drawcoil
  7700. >end
  7701. drawcoil defined
  7702.  
  7703. The  throw  "notbigger instruction in the  grownumber  procedure
  7704. always  returns  Dr.  Logo  to the trap  procedure.  If  a  stop
  7705. instruction  had  been  used instead of throw,  Dr.  Logo  would
  7706. return  to the procedure that called grownumber, which might  be
  7707. either coil or drawcoil.
  7708.  
  7709. The following procedures allow the user to type commands just as
  7710. he  normally would to the Dr. Logo interpreter. However, if  the
  7711. user enters a command incorrectly, the mymessage procedure traps
  7712. the normal Dr. Logo error message and prints a custom message.
  7713.  
  7714. ?to mymessage
  7715. >catch "error [interpret]
  7716. >pr "Oops! first butfirst error [! ! !]
  7717. >pr [What do you want to do about that?]
  7718. >run readlist
  7719. >mymessage
  7720. >end
  7721. mymessage defined
  7722. ?to interpret
  7723. >pr [What next, boss?]
  7724. >run readlist
  7725. >interpret
  7726. >end
  7727. interpret defined
  7728.  
  7729.  
  7730. to
  7731. --
  7732.  
  7733. Action:
  7734. Indicates the beginning of a procedure definition.
  7735.  
  7736. Syntax:
  7737. to procname <inputs>
  7738.  
  7739. Explanation:
  7740. to is a special word that indicates the beginning of a procedure
  7741. definition.  At  toplevel,  to signals Dr.  Logo  that  you  are
  7742. starting  to define a procedure, and puts you in  the  procedure
  7743. editor (the > prompt).
  7744.  
  7745. to  is not part of a procedure's definition list, and is  not  a
  7746. primitive. You can use "to" as a procedure or variable name,  if
  7747. you are confident that the name will not cause undue confusion.
  7748.  
  7749. Examples:
  7750. ?to pent
  7751. >repeat 5 [fd 25 lt 72]
  7752. >end
  7753. pent defined
  7754.  
  7755.  
  7756. tones
  7757. -----
  7758.  
  7759. Action:
  7760. Outputs  a tone of the frequency and duration specified  in  the
  7761. input list.
  7762.  
  7763. Syntax:
  7764. tones note_list
  7765.  
  7766. Explanation:
  7767. tones outputs a note of the frequency and duration specified  in
  7768. the  input note_list. The input list must contain  two  numbers.
  7769. tones  interprets  the  first number as  the  frequency  of  the
  7770. desired  note. For example, 440 is the frequency of  concert  A.
  7771. tones interprets the second number as the number of milliseconds
  7772. the tone is to last.
  7773.  
  7774. Examples:
  7775. ?tones [440 250]
  7776. ?to scale :freq
  7777. >repeat 14
  7778. >   [
  7779. >   type list " int 0.5 + :freq
  7780. >   tones list 0.5 + :note 300
  7781. >   make "note :note * :c
  7782. >   ]
  7783. >end
  7784. scale defined
  7785. ?make "c (2 ^ (1 / 12))
  7786. ?scale 440
  7787.  440 466 494 523 554 587 622 659 698 74!
  7788. 0 784 831 880
  7789. ?to play :song :speed
  7790. >make "note first :song
  7791. >if memberp :note :notes [make interval!
  7792. where]
  7793. >(type " :note)
  7794. >if :note = "R
  7795. >   [tones list 40 :speed]
  7796. >   [tones list 440 * (:c ^ :interval) !
  7797. :speed]
  7798. >play bf :song :speed
  7799. >end
  7800. play defined
  7801. ?make "notes [A A# B C C# D D# E F F# G!
  7802. G# A' A#' B' C' C#' D' D#' E' F' F#' G'!
  7803. G#']
  7804. ?make "hb [G A' G C' B' R G A' G D' C' !
  7805. R' G G#' E' C' B' A' F' E' C' D' C']
  7806. ?play :hb 60
  7807. ?to play1 :song :speed
  7808. >make "note first :song
  7809. >if memberp :note :notes [make interval!
  7810. where]
  7811. >(type " :note)
  7812. >if :note = "R
  7813. >   [tones list 0 :speed]
  7814. >   [tones list 440 * (:c ^ :interval) !
  7815. :speed]
  7816. >if emptyp first bf :song [stop]
  7817. >make "note2 first bf :song
  7818. >if memberp :note2 :notes [make interva!
  7819. l where]
  7820. >(type " :note2)
  7821. >if :note2 = "R
  7822. >   [tones list 0 :speed * 4]
  7823. >   [tones list 440 * (:c ^ :interval) !
  7824. :speed * 4]
  7825. >play bf bf :song :speed
  7826. >end
  7827. play1 defined
  7828. ?make "turtlesong [D G A' A#' A' A#' R !
  7829. R A' A#' R R R D' R C' A#' A' G A' G A'!
  7830. R R G F G A' R R C' A#' A' G F G F G R !
  7831. R F D# F G R R G G A' R G F# R D'
  7832. ?play :turtlesong 14
  7833.  D G A' A#' A' A#' R R A' A#' R R R D' !
  7834. R C' A#' A' G A' G A' R R G F G A' R R !
  7835. C' A#' A' G F G F G R R F D# F G R R G !
  7836. G A' R G F# R D'
  7837.  
  7838.  
  7839. towards
  7840. -------
  7841.  
  7842. Action:
  7843. Outputs  a heading that would make the turtle face the  position
  7844. specified in the input coordinate list.
  7845.  
  7846. Syntax:
  7847. towards coord_list
  7848.  
  7849. Explanation:
  7850. towards  outputs a heading that would make the turtle  face  the
  7851. position  specified  in the input coordinate list. To  make  the
  7852. turtle  turn towards the position, use the output of towards  as
  7853. the input to setheading.
  7854.  
  7855. Examples:
  7856. ?cs
  7857. ?towards [75 50]
  7858. 56.3099324740202
  7859. ?towards [-75 -50]
  7860. 236.30993247402
  7861. ?to plot.sine
  7862. >make "val 0
  7863. >make "x -150
  7864. >make "inc (300 / 60)
  7865. >setx 150 setx :x
  7866. >plot :val
  7867. >end
  7868. plot.sine defined
  7869. ?to plot :val
  7870. >if :x > 150 [stop]
  7871. >make "y (90 * (sin :val))  ; 90 makes !
  7872. plot visible
  7873. >setheading towards list :x :y
  7874. >setpos list :x :y
  7875. >make "x :x + :inc
  7876. >make "val :val + 6
  7877. >plot :val
  7878. >end
  7879. plot defined
  7880. ?plot.sine
  7881.  
  7882. See Colorplate 51. plot.sine (towards Primitive)
  7883.  
  7884.  
  7885. trace
  7886. -----
  7887.  
  7888. Action:
  7889. Turns on trace monitoring of all or specified procedure(s).
  7890.  
  7891. Syntax:
  7892. trace <procname | procname_list>
  7893.  
  7894. Explanation:
  7895. trace turns on trace monitoring of procedure execution.  Tracing
  7896. displays  the  name of each procedure as it is called,  and  the
  7897. name  and  value  of each variable as it  is  defined.  It  also
  7898. displays  the level number, the number of procedures  that  have
  7899. been called since a procedure was initiated at toplevel.
  7900.  
  7901. Tracing  lets you observe details of your procedure's  execution
  7902. without  interrupting  with pauses. Use watch or Ctrl-Z  if  you
  7903. want to pause during procedure execution.
  7904.  
  7905. Examples:
  7906. ?to average :numbers
  7907. >make "total 0
  7908. >addup :numbers
  7909. >pr :total / count :numbers
  7910. >end
  7911. average defined
  7912. ?to addup :list
  7913. >if emptyp :list [stop]
  7914. >make "total :total + first :list
  7915. >addup bf :list
  7916. >end
  7917. addup defined
  7918. ?trace
  7919. ?average [1 2 3]
  7920. [1] Evaluating average
  7921. [1] numbers is [1 2 3]
  7922. [2] Evaluating addup
  7923. [2] list is [1 2 3]
  7924. [3] Evaluating addup
  7925. [3] list is [2 3]
  7926. [4] Evaluating addup
  7927. [4] list is [3]
  7928. [5] Evaluating addup
  7929. [5] list is []
  7930. 2
  7931. ?notrace
  7932. ?average [1 2 3]
  7933. 2
  7934.  
  7935.  
  7936. turtlefacts tf
  7937. --------------
  7938.  
  7939. Action:
  7940. Outputs a list of information about the turtle.
  7941.  
  7942. Syntax:
  7943. turtlefacts
  7944. tf
  7945.  
  7946. Explanation:
  7947. Outputs a list that contains: Turtle's X-coordinate; Turtle's Y-
  7948. coordinate;  Turtle's  heading; Pen state; Pen's  color  number;
  7949. TRUE if the turtle is visible, FALSE if not.
  7950.  
  7951. Examples:
  7952. ?turtlefacts
  7953. [15 30 60 PE 3 FALSE]
  7954.  
  7955.  
  7956. turtletext tt
  7957. -------------
  7958.  
  7959. Action:
  7960. Displays  the input object at the turtle's current  location  on
  7961. the graphic screen.
  7962.  
  7963. Syntax:
  7964. turtletext object
  7965. tt object
  7966.  
  7967. Explanation:
  7968. turtletext displays the input object on the graphic screen.  The
  7969. first character of the input object appears to the right of  the
  7970. turtle's center line, plus zero to four turtle steps (pixels) to
  7971. align with the closest character cell.
  7972.  
  7973. Like print, turtletext removes the outer brackets from any input
  7974. list,  and follows the last input item with a  Carriage  Return.
  7975. Without  punctuation, turtletext requires and accepts one  input
  7976. object.  turtletext can accept more inputs when you enclose  the
  7977. turtletext expression is parentheses ["(" and ")"]. If no  other
  7978. expressions follow the turtletext expression on the line, you do
  7979. not need to type the closing right parenthesis [")"].
  7980.  
  7981. The  text  can be one of four current pencolors. Use  textfg  to
  7982. specify  a  text color. The text can also have any  one  of  the
  7983. pencolors  as  a  background  color. Use  textbg  to  specify  a
  7984. background color for text on the graphic screen.
  7985.  
  7986. Examples:
  7987. ?cs
  7988. ?turtletext "home fd 10
  7989. ?tt rq fd 10
  7990. I want to go
  7991.  
  7992. See Colorplate 52. tt rq (turtletext Primitive)
  7993.  
  7994.  
  7995. type
  7996. ----
  7997.  
  7998. Action:
  7999. Displays the input objects on the screen.
  8000.  
  8001. Syntax:
  8002. type object (...)
  8003.  
  8004. Explanation:
  8005. type  displays  the  input object on the screen,  but  does  not
  8006. follow  the  last  input object with  a  Carriage  Return.  type
  8007. removes  the outer square brackets ("[" and "]") from  an  input
  8008. list. You can input any number of objects by preceding type with
  8009. a  left parenthesis ["("]. When preceded by a parenthesis,  type
  8010. displays  all  its inputs on the same line.  Compare  type  with
  8011. print and show.
  8012.  
  8013. Examples:
  8014. ?type [This is the turtle's position: ]!
  8015. pos
  8016. This is the turtle's position: [-19 -21]
  8017. ?to newprompt :prompt
  8018. >(type :prompt " )
  8019. >run readlist
  8020. >newprompt :prompt
  8021. >end
  8022. newprompt defined
  8023. ?newprompt [\=\>]
  8024. => repeat 5 fd 40 lt 72
  8025. =>
  8026.  
  8027.  
  8028. unbury
  8029. ------
  8030.  
  8031. Action:
  8032. Restores  the  specified  package(s)  to  workspace   management
  8033. commands.
  8034.  
  8035. Syntax:
  8036. unbury pkgname | pkgname_list
  8037.  
  8038. Explanation:
  8039. unbury  restores the specified package or packages to  workspace
  8040. management commands. unbury works by removing the bury  property
  8041. (.BUR) from the package's property list. The description of bury
  8042. command  tells  how workspace management commands  treat  buried
  8043. packages.
  8044.  
  8045. Examples:
  8046. These examples assume you have the following in your  workspace:
  8047. a  package named figures that contains two variables  named  big
  8048. and  small and two procedures named square and triangle,  and  a
  8049. package named titles that contains two procedures named prauthor
  8050. and prdate.
  8051.  
  8052. ?popkg
  8053. figures
  8054.   "big (VAL)
  8055.   "small (VAL)
  8056.   to square
  8057.   to triangle
  8058. titles
  8059.   to prauthor
  8060.   to prdate
  8061. ?bury "titles
  8062. ?popkg
  8063. figures
  8064.   "big (VAL)
  8065.   "small (VAL)
  8066.   to square
  8067.   to triangle
  8068. titles is buried
  8069.   to prauthor
  8070.   to prdate
  8071. ?pots
  8072. to square
  8073. to triangle
  8074.  
  8075.  
  8076. uppercase uc
  8077. ------------
  8078.  
  8079. Action:
  8080. Outputs  the  input  word  with  all  alphabetic  characters  in
  8081. uppercase.
  8082.  
  8083. Syntax:
  8084. uppercase word
  8085. uc word
  8086.  
  8087. Explanation:
  8088. uppercase outputs the input word with all alphabetic  characters
  8089. converted to uppercase.
  8090.  
  8091. Examples:
  8092. ?uppercase "jones
  8093. JONES
  8094. ?uppercase "BeckyAnn
  8095. BECKYANN
  8096. ?to quiz
  8097. >pr [Can you play the ocarina?]
  8098. >if "N = uc first rq
  8099. >   [pr [Me neither!]]
  8100. >   [pr [Wow, I've never met anyone who !
  8101. did!]
  8102. >end
  8103. quiz defined
  8104. ?quiz
  8105. Can you play the ocarina?
  8106. not really
  8107. Me neither!
  8108.  
  8109.  
  8110. wait
  8111. ----
  8112.  
  8113. Action:
  8114. Stops  execution for the amount of time specified by  the  input
  8115. number.
  8116.  
  8117. Syntax:
  8118. wait n
  8119.  
  8120. Explanation:
  8121. wait  stops  execution for the amount of time specified  by  the
  8122. input number. wait interprets the input number as the number  of
  8123. 1/60ths of a second it is to wait. For example, to stop for  one
  8124. second, use wait 60.
  8125.  
  8126. Examples:
  8127. ?wait 60
  8128. ?repeat 10 [type "tick wait 30 pr "tock!
  8129. wait 30]
  8130. ticktock
  8131. ticktock
  8132. ticktock
  8133. ticktock
  8134. ticktock
  8135. ticktock
  8136. ticktock
  8137. ticktock
  8138. ticktock
  8139. ticktock
  8140. ?to bg.cycle :val
  8141. >if :val = 0 [pr [Cycle complete.] setb!
  8142. g 1 stop]
  8143. >setbg :val
  8144. >(pr [This is background color number] !
  8145. bg)
  8146. >wait 100
  8147. >bg.cycle :val - 1
  8148. >end
  8149. bg.cycle defined
  8150. ?bg.cycle 8
  8151. This is background color 8
  8152. This is background color 7
  8153. This is background color 6
  8154. This is background color 5
  8155. This is background color 4
  8156. This is background color 3
  8157. This is background color 2
  8158. This is background color 1
  8159. Cycle complete.
  8160.  
  8161.  
  8162. watch
  8163. -----
  8164.  
  8165. Action:
  8166. Turns on watch monitoring of all or specified procedure(s).
  8167.  
  8168. Syntax:
  8169. watch <procname | procname_list>
  8170.  
  8171. Explanation:
  8172. watch turns on expression-by-expression monitoring of  procedure
  8173. execution. watch displays each expression before execution,  and
  8174. pauses until you press the Enter key. During the pause, you  can
  8175. examine  the  values  of local variables,  and  experiment  with
  8176. variations  of the expression before the expression is  actually
  8177. executed.  If you want the values of variables to  be  displayed
  8178. automatically, enable trace as well as watch.
  8179.  
  8180. watch  also displays a number in square brackets ("["  and  "]")
  8181. before  the  expression. This level number tells  you  how  many
  8182. procedures your procedure has called since it began execution.
  8183.  
  8184. If you give watch a procedure name or a list of procedure  names
  8185. as   input,  only  the  specified  procedures   are   monitored.
  8186. Otherwise,  any procedure you initiate at toplevel or call  from
  8187. within another procedure is monitored.
  8188.  
  8189. Normally,  anything an expression displays on the  text  appears
  8190. interspersed  with  the information that watch displays  on  the
  8191. screen.
  8192.  
  8193. To stop the watch step-by-step monitoring, enter nowatch.
  8194.  
  8195. Examples:
  8196. ?to average :numbers
  8197. >make "total 0
  8198. >addup :numbers
  8199. >pr :total / count :numbers
  8200. >end
  8201. average defined
  8202. ?to addup :list
  8203. >if emptyp :list [stop]
  8204. >make "total :total + first :list
  8205. >addup bf :list
  8206. >end
  8207. addup defined
  8208. ?watch
  8209. ?average [1 2 3]
  8210. [1] In average, make "total 0
  8211. [1] In average, addup :numbers
  8212. [2] In addup, if emptyp :list [stop]
  8213. [2] In addup, make "total :total + firs!
  8214. t :list
  8215. [2] In addup, addup bf :list
  8216. [3] In addup, if emptyp :list [stop]
  8217. [3] In addup, make "total :total + firs!
  8218. t :list
  8219. [3] In addup, addup bf :list
  8220. [4] In addup, if emptyp :list [stop]
  8221. [4] In addup, make "total :total + firs!
  8222. t :list
  8223. [4] In addup, addup bf :list
  8224. [5] In addup, if emptyp :list [stop]
  8225. [1] In average, pr :total / count :numb!
  8226. ers
  8227. 2
  8228. ?nowatch
  8229. ?average [1 2 3]
  8230. 2
  8231.  
  8232.  
  8233. where
  8234. -----
  8235.  
  8236. Action:
  8237. Outputs  the item number of the most recent  successful  memberp
  8238. expression.
  8239.  
  8240. Syntax:
  8241. where
  8242.  
  8243. Explanation:
  8244. where  outputs  a  number that identifies  the  location  of  an
  8245. element within a word or list if a memberp expression containing
  8246. that  element and word or list outputs TRUE. where  outputs  the
  8247. item number of the most recent successful memberp expression.
  8248.  
  8249. Examples:
  8250. ?memberp "v" river
  8251. TRUE
  8252. ?show where
  8253. 3
  8254. ?to use :what
  8255. >if memberp lc :what [green red yellow]
  8256. >   [make "colornumber where
  8257. >   make "state "PENDOWN]
  8258. >if "eraser = lc :what [make "state "PE!
  8259. NERASE]
  8260. >run (se "setpen "list "quote :state "q!
  8261. uote :colornumber)
  8262. >end
  8263. use defined
  8264. ?use "green fd 80 rt 120
  8265. ?use "red fd 80 rt 120
  8266. ?use "yellow fd 80 rt 120
  8267.  
  8268. See Colorplate 53. use "yellow fd 80 rt 120 (where Primitive)
  8269.  
  8270.  
  8271. window
  8272. ------
  8273.  
  8274. Action:
  8275. Allows the turtle to plot outside the visible graphic screen.
  8276.  
  8277. Syntax:
  8278. window
  8279.  
  8280. Explanation:
  8281. window  allows  the turtle to plot outside the  visible  graphic
  8282. screen. When you first start Dr. Logo, the turtle can go  beyond
  8283. the  visible screen and return. You can enter wrap or  fence  to
  8284. limit  the  turtle to on-screen plotting.  To  resume  offscreen
  8285. plotting after a wrap or fence command, enter window.
  8286.  
  8287. Examples:
  8288. ?fence
  8289. ?to squiral :side
  8290. >repeat 4 [fd :side rt 90]
  8291. >rt 20
  8292. >squiral :side + 5
  8293. >end
  8294. squiral defined
  8295. ?squiral 20
  8296. Turtle out of bonds in squiral: repeat!
  8297. 4 [fd :side rt 90]
  8298. ?window
  8299. ?squiral 20 Ctrl-G
  8300.  
  8301. See Colorplate 54. squiral 20 (window Primitive)
  8302.  
  8303.  
  8304. word
  8305. ----
  8306.  
  8307. Action:
  8308. Outputs a word made up of the input words.
  8309.  
  8310. Syntax:
  8311. word word word (...)
  8312.  
  8313. Explanation:
  8314. word  outputs  a  word  made up  of  the  input  words.  Without
  8315. punctuation,  word requires and accepts two input objects.  word
  8316. can  accept  more  or fewer inputs when  you  enclose  the  word
  8317. expression in parentheses ["(" and ")"]. If no other expressions
  8318. follow the word expression on the line, you do not need to  type
  8319. the closing right parenthesis [")"].
  8320.  
  8321. Examples:
  8322. ?word "Hocus "Pocus
  8323. HocusPocus
  8324. ?word 23 "skiddoo
  8325. 23skiddoo
  8326. ?(word "ab "ra "ca "da "bra
  8327. abracadabra
  8328. ?to make.string :list
  8329. >if emptyp :list [op "]
  8330. >op (word first :list char 32 make.stri!
  8331. ng bf :list)
  8332. >end
  8333. make.string defined
  8334. ?fkey 2 make.string [fd 40 rt 160]
  8335. ?fd 40 rt 160 Ctrl-G Enter
  8336. ?fd 40 rt 160 Ctrl-G Enter
  8337. ?fd 40 rt 160 Ctrl-G Enter
  8338. ?fd 40 rt 160 Ctrl-G Enter
  8339. ?fd 40 rt 160 Ctrl-G Enter
  8340. ?fd 40 rt 160 Ctrl-G Enter
  8341. ?fd 40 rt 160 Ctrl-G Enter
  8342. ?fd 40 rt 160 Ctrl-G Enter
  8343. ?fd 40 rt 160 Ctrl-G Enter
  8344.  
  8345.  
  8346. wordp   (= WORD Predicate)
  8347. -----
  8348.  
  8349. Action:
  8350. Outputs TRUE if the input object is a word or a number.
  8351.  
  8352. Syntax:
  8353. wordp object
  8354.  
  8355. Explanation:
  8356. wordp  outputs TRUE if the input object is a word or  a  number.
  8357. Otherwise, wordp outputs FALSE.
  8358.  
  8359. Examples:
  8360. ?wordp "Naima
  8361. TRUE
  8362. ?wordp 50
  8363. TRUE
  8364. ?wordp [word]
  8365. FALSE
  8366. ?wordp bf [green red yellow]
  8367. FALSE
  8368. ?to list.memberp :word :list
  8369. >if emptyp :list [op "FALSE]
  8370. >if wordp first :list
  8371. >   [if :word = first :list
  8372. >       [op "TRUE]
  8373. >       [op list.memberp :word bf :list!
  8374. ]]
  8375. >if list.memberp :word first :list [op !
  8376. "TRUE]
  8377. >op list.memberp :word bf :list
  8378. >end
  8379. list.memberp defined
  8380. ?make "address.book [[name [Mr. Preside!
  8381. nt]] [street [1600 Pennsylvania Avenue]!
  8382. ][city/state [Washington D.C.]]]
  8383. ?list.memberp "Washington :address.book
  8384. TRUE
  8385. ?list.memberp "Oregon :address.book
  8386. FALSE
  8387.  
  8388.  
  8389. wrap
  8390. ----
  8391.  
  8392. Action:
  8393. Makes  the turtle re-appear on the opposite side of  the  screen
  8394. when it exceeds the boundary.
  8395.  
  8396. Syntax:
  8397. wrap
  8398.  
  8399. Explanation:
  8400. wrap  makes  the turtle re-appear on the opposite  side  of  the
  8401. graphic screen when it moves beyond an edge. While wrap is  set,
  8402. the turtle never leaves the visual field. To allow the turtle to
  8403. plot offscreen, enter window.
  8404.  
  8405. Examples:
  8406. ?wrap
  8407. ?fd 180
  8408. ?cs
  8409. ?to plaid
  8410. >wrap
  8411. >setpc 3 rt 40 forward 10965
  8412. >setpc 2 rt 90 forward 5000
  8413. >setpc 1 pu rt 90 fd 6 pd ht
  8414. >repeat 625 [fd 3 lt 90 fd 1 rt 90 bk 3!
  8415. lt 90 fd 1 rt 90]
  8416. >end
  8417. plaid defined
  8418. ?plaid
  8419.  
  8420. See Colorplate 16. plaid (wrap Primitive)
  8421.  
  8422.  
  8423. writer
  8424. ------
  8425.  
  8426. Action:
  8427. Outputs the current data file.
  8428.  
  8429. Syntax:
  8430. writer
  8431.  
  8432. Explanation:
  8433. Outputs the current data file that is open for writing.
  8434.  
  8435. Examples:
  8436. ?writer
  8437. [A:ADDRESS.DAT]
  8438.  
  8439.  
  8440. xcor
  8441. ----
  8442.  
  8443. Action:
  8444. Outputs the X coordinate of the turtle's current position.
  8445.  
  8446. Syntax:
  8447. xcor
  8448.  
  8449. Explanation:
  8450. xcor outputs the X coordinate of the turtle's current  position.
  8451. xcor is equivalent to a first pos expression.
  8452.  
  8453. Examples:
  8454. ?cs xcor
  8455. 0
  8456. ?to jump
  8457. >setpos list
  8458. >   random 150 * first shuffle [1 -1]
  8459. >   random 100 * first shuffle [1 -1]
  8460. >end
  8461. jump defined
  8462. ?jump xcor
  8463. 145
  8464. ?jump xcor
  8465. -64
  8466.  
  8467. See Colorplate 55. jump xcor (xcor Primitive)
  8468.  
  8469.  
  8470. ycor
  8471. ----
  8472.  
  8473. Action:
  8474. Outputs the Y coordinate of the turtle's current position.
  8475.  
  8476. Syntax:
  8477. ycor
  8478.  
  8479. Explanation:
  8480. ycor outputs the Y coordinate of the turtle's current  position.
  8481. ycor is equivalent to a last pos expression.
  8482.  
  8483. Examples:
  8484. ?cs ycor
  8485. 0
  8486. ?to jump
  8487. >setpos list
  8488. >   random 150 * first shuffle [1 -1]
  8489. >   random 100 * first shuffle [1 -1]
  8490. >end
  8491. jump defined
  8492. ?jump ycor
  8493. 36
  8494. ?jump ycor
  8495. 49
  8496.  
  8497. See Colorplate 56. jump ycor (ycor Primitive)
  8498.  
  8499.  
  8500. EOF
  8501.  
  8502.  
  8503.  
  8504.