ITS Muddle 54 documentation, from TOPS-20 directory.
[pdp10-muddle.git] / <mdl.documentation> / muddle.order.1
1 MUDDLE F/SUBRS:         (for MUDDLE 55)         PDL/SWG 3/8/79
2
3         The following is a very brief description of all the
4 primitives currently available in MDL. These descriptions are in
5 no way to be considered a definition of the effects or values
6 produced by the primitives.  They just try to be as complete and
7 as accurate as is possible in a single-statement description.
8 However, because of the complexity of most primitives, many
9 important defaults and restrictions have been omitted.
10 \f
11 *:        Multiplication of fixes and floats.
12
13 Object-type:  SUBR
14
15 Category:  ARITHMETIC
16
17      * (Multiply) takes any number of FIXes or FLOATs, and multiplies
18 them together, returning the result.  If any of the arguments are
19 FLOATs, the result will be FLOAT.  If no argument is given, * returns
20 1, if one argument is given, * returns that argument.
21      * will given an arithmetic overflow error (unless disabled by OVERFLOW)
22 if the word size of the PDP-10 is exceeded.
23
24 Argument:
25
26   Template:  #DECL ("VALUE" <OR FIX FLOAT>
27                     "TUPLE" <TUPLE [REST <OR FIX FLOAT>]>)
28
29 (Optional)
30 Tuple of arguments -- FIXes and FLOATs
31 Returns -- FIX or FLOAT, floating is contagious.
32
33 Example:  <* 1 2.0>
34           2.0
35 Floating is contagious.
36 \f
37 +:        Add fixes and floats.
38
39 Object-type:  SUBR
40
41 Category:  ARITHMETIC
42
43      + adds together any number of FIXes or FLOATs, returning the
44 result.  Floating is contagious, as in all arithmetic SUBRs.  If no
45 argument is given, + returns 0, if one argument, + returns the argument.
46      + will give an arithmetic overflow error (unless disabled by
47 OVERFLOW) if the result (or an intermediate result) exceeds the word
48 size of the PDP-10.
49
50 Argument:
51
52   Template:  #DECL ("VALUE" <OR FIX FLOAT>
53                     "TUPLE" <TUPLE [REST <OR FIX FLOAT>]>)
54
55 (Optional)
56 Tuple of arguments -- FIXes and FLOATs.
57 Returns -- FIX or FLOAT, sum of arguments.
58
59 Example:  <+ !<SET FOO (1 2 3)!>>
60           6
61 Sum of elements of list.
62 \f
63 -:        Subtract fixes and floats.
64
65 Object-type:  SUBR
66
67 Category:  ARITHMETIC
68
69      - takes any number of fixes or floats and subtracts from the first
70 one all of the remaining ones.  If no argument is given, returns 0. If
71 one argument is given, returns its negation.  Floating is contagious,
72 and - will give an arithmetic overflow error (unless disabled by OVERFLOW)
73 if the word size of the PDP-10 is exceeded.
74
75 Argument:
76
77   Template:  #DECL ("VALUE" <OR FIX FLOAT>
78                     "TUPLE" <TUPLE [REST <OR FIX FLOAT>]>)
79
80 (Optional)
81 Tuple of arguments -- FIXes and FLOATs.
82 Returns -- The FIX or FLOAT result of the subtraction.
83
84 Example:  <- 5 3 2>
85           0
86 All but first argument are subtracted from first.
87 \f
88 /:        Divide fixes and floats.
89
90 Object-type:  SUBR
91
92 Category:  ARITHMETIC
93
94      / divides any number of fixes and floats.  The first is divided
95 successively by each of the remaining arguments.  If no arguments are
96 given, returns 1.  If one argument is given, returns its reciprocal.
97 Floating is contagious.  If the arguments are FIX, the result is
98 always completely fixed point division, with no rounding.
99 / will give an arithmetic overflow error (unless disabled by OVERFLOW)
100 if the word size of the PDP-10 is exceeded.
101
102 Argument:
103
104   Template:  #DECL ("VALUE" <OR FIX FLOAT>
105                     "TUPLE" <TUPLE [REST <OR FIX FLOAT>]>)
106
107 (Optional)
108 Tuple of arguments -- FIXes and FLOATs
109 Returns -- FIX or FLOAT quotient.
110
111 Example:  </ 10 7 2.0>
112           0.5
113 First division gave 1, then .5 after second.
114 \f
115 0?:       Tests if a fix or float is zero.
116
117 Object-type:  SUBR
118
119 Category:  ARITHMETIC
120
121      0? tests a FIX or FLOAT to see if it is equal to zero.  If it is
122 not, a FALSE is returned.  If it is, T is returned.
123
124 Argument:
125
126   Template:  #DECL ("VALUE" <OR FALSE 'T> <OR FIX FLOAT>)
127
128 Argument 1 -- A FIX or FLOAT.
129 Returns -- FALSE if not equal to 0, T if equal to zero.
130
131 Example:  <0? 1>
132           #FALSE ()
133 Trivial, isn't it?
134 \f
135 1?:       Tests if a fix or float is equal to one.
136
137 Object-type:  SUBR
138
139 Category:  ARITHMETIC
140
141      1? takes a fix or float and tests its equality to one.  If it is
142 not equal, returns FALSE.  If it is equal, returns T.
143
144 Argument:
145
146   Template:  #DECL ("VALUE" <OR FALSE 'T> <OR FIX FLOAT>)
147
148 Argument 1 -- FIX or FLOAT to test.
149 Returns -- FALSE if not 1, T if 1.
150
151 Example:  <1? 1.0>
152           T
153 Works for floats, too.
154 \f
155 1STEP:    Put a PROCESS in One-step mode
156
157 Object-type:  SUBR
158
159 Category:  PROCESS-CONTROL
160
161 Reference:  RESUME, FREE-RUN
162
163      1STEP puts a PROCESS in single step mode.  It takes as argument
164 a PROCESS.  When RESUMEd, the PROCESS will be in one-step mode, running
165 until an EVAL is either entered or left.
166      The PROCESS which executed the 1STEP will then be RESUMEd.  It
167 will be passed a tuple.  If EVAL was being entered, the tuple will
168 contain the ATOM EVLIN and the arguments to EVAL.  If EVAL was being
169 left, the tuple will contain the ATOM EVLOUT and the result of the
170 evaluation.
171      The PROCESS will remain in 1STEP mode until FREE-RUN is done on
172 it.  RESUME will thus stop at each EVAL until then.
173
174 Argument:
175
176   Template:  #DECL ("VALUE" PROCESS PROCESS)
177
178 Argument 1 -- A PROCESS to put in one-step mode.
179 Returns -- The PROCESS.
180
181 Example:  <1STEP .FOO>
182 returns #PROCESS i
183           <RESUME .FOO>
184           [EVLIN <+ 1 1>]
185           <RESUME .FOO>
186           [EVLOUT 2]
187 Two successive steps of the process.
188 \f
189 ==?:      Test for physical identity of two objects.
190
191 Object-type:  SUBR
192
193 Category:  PREDICATE
194
195 Reference:  =?
196
197      ==? tests two objects for physical identity.  For ==? to return
198 T (true), the two objects must have the same identical type-value pair.
199 For example, two STRINGs typed in from the console will not be ==?, but
200 two ATOMS, FIXes, or nil LISTs will be.
201      If the two objects are not the same, ==? returns FALSE.
202
203 Argument:
204
205   Template:  #DECL ("VALUE" <OR 'T FALSE> ANY ANY)
206
207 Argument 1 -- Any object.
208 Argument 2 -- Another object.
209 Returns -- T if the two objects are the same, FALSE otherwise.
210
211 Example:  <==? "FOO" "FOO">
212           #FALSE ()
213 These two STRINGs look identical, but are not.
214 \f
215 =?:       Test for structural identity of two objects.
216
217 Object-type:  SUBR
218
219 Category:  PREDICATE
220
221 Reference:  ==?
222
223      =? is a less stringent, but more expensive, test for identity
224 than ==?.  It also takes two objects as arguments, but tests only for
225 structural identity of the objects, rather than physical identity.  If
226 two objects print the same, they will be =? to each other, except for
227 numeric fuzz.  For example, two STRINGs typed in from the console will
228 be =? to each other, but not ==?.  Any objects that are ==? will also
229 be =?, and if ==? applies, it should be used.  =? is much more
230 expensive than ==?, in general, as it must test an entire structure
231 piece by piece.
232      =? returns T if the objects are structurally identical, and FALSE if
233 they are not.
234
235 Argument:
236
237   Template:  #DECL ("VALUE" <OR 'T FALSE> ANY ANY)
238
239 Argument 1 -- Any object.
240 Argument 2 -- Any other object.
241 Returns -- T if the arguments are structurally equal, FALSE if they
242         are not.
243
244 Example:  <=? <SET V <VECTOR 1 2 3>> <EVAL .V>>
245           T
246 If the test were ==?, the result would be FALSE.
247 \f
248 ABS:      Returns the Absolute value of a FIX or FLOAT.
249
250 Object-type:  SUBR
251
252 Category:  ARITHMETIC
253
254         Returns the absolute value of its argument.
255
256 Argument:
257
258   Template:  #DECL ("VALUE" <OR FIX FLOAT> <OR FIX FLOAT>)
259
260 Argument 1 -- A FIX or FLOAT to take the absolute value of.
261 Returns -- A FIX or FLOAT guaranteed non-negative.
262
263 Example:  <ABS -69105>
264           69105
265 Simple SUBR, simple example.
266 \f
267 ACCESS:   Position channel to given point in file
268
269 Object-type:  SUBR
270
271 Category:  I/O
272
273 Reference:  FILE-LENGTH
274
275         ACCESS makes the next character or binary word (depending on
276 the channel's mode) which will be input from or output to a channel
277 the (arg2+1)st one from the beginning of the file.
278
279 Argument:
280
281   Template:  #DECL ("VALUE" CHANNEL CHANNEL FIX)
282
283 Argument 1 -- the channel, open (not in "PRINT" mode) to DSK, USR, etc.
284 Argument 2 -- where to point for next i/o
285 Returns -- the channel
286
287 Example:  <ACCESS .IN 0>
288 starts reading again from beginning of file
289 \f
290 ACTIVATE-CHARS:  Set or inspect interrupt characters for console typing (TENEX only)
291 "VALUE" STRING
292 "OPTIONAL" STRING
293 \f
294 AGAIN:    Restart a FUNCTION, PROG, or REPEAT
295
296 Object-type:  SUBR
297
298 Category:  PROGRAM-CONTROL
299
300 Reference:  FUNCTION, PROG, REPEAT
301
302      AGAIN takes one argument:  an ACTIVATION.  It means 'start doing
303 this again', where 'this' is specified by the ACTIVATION.  Specifically,
304 AGAIN causes EVAL to return to where it started working on the body of
305 the FUNCTION, REPEAT, or PROG in the application specified by the
306 ACTIVATION.  The application is not re-evaluated completely:  no
307 rebinding of variables is done.
308      In a PROG or REPEAT, where there is always a defined ACTIVATION,
309 AGAIN with no arguments defaults to AGAIN of the top-level ACTIVATION
310 in the PROG or REPEAT.
311
312 Argument:
313
314   Template:  #DECL ("VALUE" ANY "OPTIONAL" ACTIVATION)
315
316 (Optional)
317 Argument 1 -- The ACTIVATION to restart.  If not given, that of the
318         immediately surrounding PROG or REPEAT is used.
319 Returns -- Nothing, restarts the ACTIVATION.
320
321 Example:  <PROG ((X <ILIST 20 '<MOD <RANDOM> 10>>))
322                 <COND (<G=? <+ !.X> 100>
323                        <SET X <REST .X>>
324                        <AGAIN>)
325                       (ELSE <PRINT <LENGTH .X>>)>>
326
327 How many elements must be rested off before total of rest is less
328 than fifty?  This could just as easily be a REPEAT, where the AGAIN is
329 implicit.
330 \f
331 ALLTYPES: Return the MUDDLE type VECTOR
332
333 Object-type:  SUBR
334
335 Category:  TYPE-MANIPULATION
336
337      ALLTYPES returns the user a pointer to the MUDDLE type vector.
338 Note that this is the real, honest-to-God type vector and that if you
339 clobber it you will clobber your MUDDLE, probably beyond repair.
340      The type vector contains ATOMs whose names are the types that are
341 currently defined to exist in the MUDDLE in which the ALLTYPES was
342 executed.
343
344 Argument:
345
346   Template:  #DECL ("VALUE" <VECTOR [REST ATOM]>)
347
348 Returns -- The MUDDLE type VECTOR.
349
350 Example:  <ALLTYPES>
351 Only possible example.
352 \f
353 AND:      Logical AND of its arguments.
354
355 Object-type:  FSUBR
356
357 Category:  PREDICATE, PROGRAM-CONTROL
358
359 Reference:  COND, OR, AND?
360
361      AND is an FSUBR that evaluates its arguments, one by one, until
362 either one of them returns a FALSE or it runs out of arguments.
363      The fact that it is an FSUBR means that it can be used as a
364 miniature COND.  A construct of the form <AND preconditions thing> will
365 allow 'thing' to be executed only if 'preconditions' is true.  In com-
366 bination with OR, fairly powerful constructs can be generated.
367      AND takes any number of arguments, returning either the result of
368 its last evaluation (T if no arguments were given) or the FALSE that
369 caused it to complete.
370
371 Argument:
372
373   Template:  #DECL ("VALUE" <OR FALSE ANY> "ARGS" LIST)
374
375 List of unevaluated arguments -- ANY evalable objects.
376 Returns -- Terminating FALSE or terminating non-FALSE.
377
378 Example:  <AND <ASSIGNED? X> .X>
379
380 This construct attempts to take LVAL of X only if X is assigned, thus
381 avoiding the possibility of an ERROR.
382 \f
383 AND?:     Logical AND of its arguments, evaluated at call time
384
385 Object-type:  SUBR
386
387 Category:  PREDICATE, PROGRAM-CONTROL
388
389 Reference:  OR?, AND, MAPF, MAPR
390
391      AND? is a SUBR that looks at its arguments, one by one, until
392 either one of them is a FALSE or it runs out of arguments.
393      The fact that it is a SUBR means that it can be used as a
394 first argument to MAPF or MAPR.
395      AND takes any number of arguments, returning either
396 its last argument (T if no arguments were given) or the FALSE that
397 caused it to complete.
398
399 Argument:
400
401   Template:  #DECL ("VALUE" <OR FALSE ANY> "TUPLE" TUPLE)
402
403 Tuple  of evaluated arguments -- ANY objects.
404 Returns -- Terminating FALSE or terminating non-FALSE.
405
406 Example:  <MAPF ,AND? <FUNCTION (T) <G? .T 0>> .VECTOR>
407 Are all elements of this vector positive?
408 \f
409 ANDB:     Bitwise logical AND
410
411 Object-type:  SUBR
412
413 Category:  BIT-TWIDDLING, LOGICAL
414
415 Reference:  EQVB, ORB, XORB
416
417      ANDB takes any number of objects of Primtype WORD, and returns
418 a WORD containing the bitwise logical AND of the arguments.
419
420 Argument:
421
422   Template:  #DECL ("VALUE" WORD
423                     "TUPLE" <TUPLE [REST <PRIMTYPE WORD>]>)
424
425 Tuple of arguments -- Objects of primtype WORD to be ANDed together.
426 Returns -- A WORD containing the bitwise AND of the arguments.
427
428 Example:  <ANDB 511 4226793183>
429           #WORD *000000000337*
430 Primarily useful for getting fingers directly in the bits.
431 \f
432 APPLICABLE?: APPLICABLE? tests if its argument may be APPLYed.
433
434 Object-type:  SUBR
435
436 Category:  PREDICATE
437
438      APPLICABLE? takes a single object as argument, and returns T if
439 that argument may be APPLYed.  That is, it may be the first element of
440 a FORM.  Thus, an object of type FIX is applicable, as well as the more
441 obvious SUBR, FSUBR, RSUBR, FUNCTION, and so on.
442      If its argument is not applicable, returns FALSE.
443
444 Argument:
445
446   Template:  #DECL ("VALUE" <OR 'T FALSE> ANY)
447
448 Argument 1 -- ANY object to be tested for applicability.
449 Returns -- T if applicable, #FALSE() if not.
450
451 Example:  <APPLICABLE? 69>
452           T
453 NTH makes this the case.
454 \f
455 APPLY:    Apply the first arg to the rest of them.
456
457 Object-type:  SUBR
458
459 Category:  PROGRAM-CONTROL
460
461      The first argument is applied to the rest of the arguments.
462      The manner in which the application is accomplished, is determined
463 by the TYPE of the first arg as follows:
464
465 FIX:    call ,NTH with the 2nd arg and 1st arg.
466
467 SUBR:   call the Subr with the rest of the args.
468
469 RSUBR or RSUBR-ENTRY:   call the Rsubr with the rest of the args and
470      also compare them with the Rsubr's DECLs.
471
472 FUNCTION:       Bind the Atoms in the parameter list of the Function
473      to the rest of the args of the APPLY matching one-to-one.  Then
474      Bind the unsatisfied OPTIONALs, if any, and the EXTRAs to the
475      EVAL of their defaults.  As each of the above Bindings is done,
476      the DECL for that variable is also checked.  Now the elements of
477      the body of the Function are EVALed sequentially.
478         The result of the evaluation of the last element of the body
479      is the result of the Function application.  It is checked against
480      the VALUE DECL of the Function, and returned.
481
482 CLOSURE:        First Bind the Closure variables to their indicated
483      values.  Then APPLY the Function part of the Closure as above.
484
485 Others: ERROR NON-APPLICABLE-TYPE
486
487 The manner in which the application is done for a particular Type can
488 be changed through the use of the subr APPLYTYPE.
489
490 Argument:
491
492   Template:  #DECL ("VALUE" ANY APPLICABLE "TUPLE"
493                     <TUPLE [REST ANY]>)
494
495 Argument 1 -- The object to apply to the rest of the arguments.
496 Tuple of arguments -- The arguments the first argument is to be
497      applied to.
498 Returns -- The result of applying the first argument to the rest.
499
500 Example:  <APPLY <GET <TYPE .ITEM> ANALYSIS-ROUTINE> .ITEM>
501
502 This code will call a routine to process ITEM.  The routine called
503 depends solely on the TYPE of ITEM.  Therefore this represents the
504 idea of a dispatch table.
505 \f
506 APPLYTYPE: Change or examine the way a TYPE is APPLYed
507
508 Object-type:  SUBR
509
510 Category:  TYPE-MANIPULATION, PROGRAM-CONTROL
511
512 Reference:  APPLY, EVALTYPE
513
514      Changes the way a specific type is APPLYed, by either mapping
515 it into another type, or giving an explicit method via an APPLICABLE.
516      If a type is given, the type being changed will be APPLYed in the
517 same manner as that type.
518      If an APPLICABLE is given, it should take at least one argument,
519 which will be the object being APPLYed, and the rest of the arguments
520 will be what it is being APPLYed to.  Whatever the APPLICABLE returns
521 will be the result of the APPLICATION.  If ,APPLY is given, the type
522 will hereafter receive no special treatment in application to args.
523      If no second arg is given, APPLYTYPE returns the last second arg
524 given for this type, or #FALSE () if the type is receiving no special
525 treatment in application.
526
527 Argument:
528
529   Template:  #DECL ("VALUE" <OR ATOM APPLICABLE FALSE> ATOM "OPTIONAL"
530                     <OR ATOM APPLICABLE>)
531
532 Argument 1 -- The type whose APPLYTYPE to change or examine.
533 (Optional)
534 Argument 2 -- A TYPE (which means 'Apply like this type'), or an
535         APPLICABLE (meaning 'use this when you APPLY this type').
536 Returns -- The TYPE which was changed or, if no second arg, the special
537         treatment this TYPE is receiving, if any.
538
539 Example:  <APPLYTYPE
540            LIST
541            '<FUNCTION (X "TUPLE" Y) 
542                     <REPEAT ((X .X))
543                             <COND
544                              (<EMPTY? .Y> <RETURN .X>)
545                              (<TYPE? <1 .Y> FIX>
546                               <SET X
547                                    <NTH .X <1 .Y>>>)
548                              (<ERROR>)>>>>
549 Make application of a LIST be like NTH
550           <(1 2 3 (4 5 6)) 4 2>
551           5
552 \f
553 ARGS:     Return the argument Tuple of an environment
554
555 Object-type:  SUBR
556
557 Category:  UTILITY, PROGRAM-CONTROL
558
559 Reference:  FRAME, FUNCT, LEGAL?
560
561      Takes an environment and returns the argument TUPLE of the
562 top-level FRAME in that environment. The argument must be LEGAL? for
563 it to work.
564      Note that the argument Tuple returned will become illegal once
565 the stack is popped past it.
566
567 Argument:
568
569   Template:  #DECL ("VALUE" TUPLE
570                     <OR ENVIRONMENT ACTIVATION FRAME PROCESS>)
571
572 Argument 1 -- The environment whose args tuple we want.
573 Returns -- The argument Tuple of the top FRAME in the environment we passed as arg 1.
574
575 Example:  <* 3 <+ a 1>>
576 Gives an ERROR, first arg wrong type.
577           <ARGS <FRAME <FRAME>>>
578           [a 1]
579 The arguments of the frame that caused the ERROR.
580 \f
581 ASCII:    Convert Ascii codes to characters and back
582
583 Object-type:  SUBR
584
585 Category:  DATA-HANDLING
586
587      ASCII returns a CHARACTER given its 'ASCII' code (as a FIX)
588 or returns the ASCII code given the CHARACTER.
589
590 Argument:
591
592   Template:  #DECL ("VALUE" <OR CHARACTER FIX> <OR CHARACTER FIX>)
593
594 Argument 1 -- A CHARACTER or FIX to be transformed into the other.
595 Returns -- The opposite type to its argument.
596
597 Example:  <ASCII 65>
598           <ASCII !\A>
599 The first returns the character A,
600 the second *101*.
601 \f
602 ASSIGNED?: Is an Atom locally assigned ?
603
604 Object-type:  SUBR
605
606 Category:  PREDICATE, IDENTIFIER
607
608 Reference:  BOUND?
609
610      This routine is used to test if a particular Atom is locally
611 assigned, or in other words if it has a local value, in a given
612 environment, default the current one.  It does cause the activation of
613 any read monitors on that local value.
614      It returns T if the ATOM has a local value, #FALSE () otherwise.
615
616 Argument:
617
618   Template:  #DECL ("VALUE" <OR 'T FALSE> ATOM "OPTIONAL"
619                     <OR ENVIRONMENT ACTIVATION FRAME PROCESS>)
620
621 Argument 1 -- An ATOM to test.
622 (Optional)
623 Argument 2 -- the environment in which to make the test
624 Returns -- T if the ATOM has a local value, #FALSE () otherwise.
625
626 Example:  <SET FOO "ANYTHING">
627           <ASSIGNED? FOO>
628 This will return the Atom T, since FOO does have a local value.
629           <UNASSIGN FOO>
630           <ASSIGNED? FOO>
631 This will return #FALSE (), since the Atom FOO has no local value.
632           <PROG (FOO) <ASSIGNED? FOO>>
633 This will also return #FALSE (), since FOO still does not have a local value
634 \f
635 ASSOCIATIONS: Access the Association chain.
636
637 Object-type:  SUBR
638
639 Category:  ASSOCIATION
640
641 Reference:  NEXT, AVALUE, INDICATOR, ITEM
642
643      ASSOCIATIONS gives the user access to the association chain in
644 much the same way as FRAME gives access to the stack.  ASSOCIATIONS
645 returns the first association triad (item, indicator, value) in the
646 chain, as a type ASOC, which looks, but doesn't behave like, a LIST.
647      An ASOC may be passed to ITEM, INDICATOR, or AVALUE to retrieve
648 the elements of a triad, or to NEXT to retrieve the next association
649 in the chain.
650
651 Argument:
652
653   Template:  #DECL ("VALUE" <OR ASOC FALSE>)
654
655 Returns -- The first association in the association chain, FALSE if none exist.
656
657 Example:  <ASSOCIATIONS>
658 Only possible example.
659 \f
660 AT:       Get a locative to a position in a Structure
661
662 Object-type:  SUBR
663
664 Category:  DATA-HANDLING
665
666 Reference:  IN, SETLOC
667
668      Returns a locative to a position in a Structure (a VECTOR, LIST,
669 UVECTOR, STRING, etc.).
670      Takes a structure, and an optional FIX (default 1), like NTH or
671 REST, returning the locative.
672
673 Argument:
674
675   Template:  #DECL ("VALUE" LOCATIVE STRUCTURED "OPTIONAL" FIX)
676
677 Argument 1 -- A Structured object.
678 (Optional)
679 Argument 2 -- A FIX, default 1, the position in the structure.
680 Returns -- A Locative to the position in the structure.
681
682 Example:  <SET FOO (1 2 3)>
683           <SET Y <AT .FOO 3>>
684 Get locative
685           <SETLOC .Y 5>
686 Change structure
687           .FOO
688           (1 2 5)
689 Changed
690 \f
691 ATAN:     Arc-tangent of a tangent
692
693 Object-type:  SUBR
694
695 Category:  ARITHMETIC
696
697 Reference:  SIN, COS
698
699      Returns, in Radians, the angle whose tangent is the argument.
700 Note that all useful trig. functions may be derived using ATAN, COS,
701 and SIN.
702
703 Argument:
704
705   Template:  #DECL ("VALUE" FLOAT <OR FIX FLOAT>)
706
707 Argument 1 -- The tangent of some angle.
708 Returns -- The angle whose tangent is argument 1.
709
710 Example:  <ATAN </ <SIN .FOO> <COS .FOO>>>
711 Will equal .FOO
712 \f
713 ATOM:     Create an ATOM not on any OBLIST
714
715 Object-type:  SUBR
716
717 Category:  DATA-HANDLING, IDENTIFIER
718
719      ATOM creates the ATOM with PNAME its argument (a STRING).  The
720 resulting ATOM is not on any OBLIST, and thus has trailer !-#FALSE().
721
722 Argument:
723
724   Template:  #DECL ("VALUE" ATOM STRING)
725
726 Argument 1 -- The string which is the pname of the atom.
727 Returns -- The newly created ATOM.
728 Example:  <ATOM "FOO">
729 FOO!-#FALSE() -- New ATOM not on any oblist.
730 \f
731 AVALUE:   Return the value part of an Association triad
732
733 Object-type:  SUBR
734
735 Category:  ASSOCIATION
736
737 Reference:  ASSOCIATIONS, NEXT, ITEM, INDICATOR, 
738             GETPROP, GET
739
740      Given an ASOC, as returned by ASSOCIATIONS or NEXT, returns the
741 value part of the ASOC triad.
742      This is equivalent to <GETPROP item indicator> but uses the ASOC
743 instead of the item and indicator.
744
745 Argument:
746
747   Template:  #DECL ("VALUE" ANY ASOC)
748
749 Argument 1 -- An ASOC whose value field to get.
750 Returns -- The value field of the ASOC.
751
752 Example:  <PUTPROP FOO BAR BLECH>
753           <AVALUE <ASSOCIATIONS>>
754           BLECH
755           <GETPROP FOO BAR>
756           BLECH
757 If this association is the most recent one made, the last two are equivalent.
758 \f
759 BACK:     Replace items RESTed off of a structure
760
761 Object-type:  SUBR
762
763 Category:  DATA-HANDLING
764
765 Reference:  REST
766
767      BACK replaces some items removed from a non-list stucture by
768 RESTing, that is, it moves the pointer to the structure back up the
769 structure.
770      It takes two arguments, the structure, and a fix which specifies
771 how many elements to return, and defaults to 1.  An ERROR is generated
772 if there are not that many elements RESTed off the structure.
773
774 Argument:
775
776   Template:  #DECL ("VALUE" <OR VECTOR UVECTOR STRING TEMPLATE>
777                     <PRIMTYPE <OR VECTOR UVECTOR STRING TEMPLATE>> "OPTIONAL"
778                     FIX)
779
780 Argument 1 -- The structure to return elements to.
781 (Optional)
782 Argument 2 -- Number of elements to return, default is 1.
783 Returns -- The structure with the elements returned.
784
785 Example:  <SET X
786                <REST [A B C D E]
787                      3>>
788           [D E]
789           <BACK .X 1>
790           [C D E]
791 .X, of course, is not changed by the BACK.
792 \f
793 BIND:     Execute sequential expressions without providing default activation
794
795 Object-type:  FSUBR
796
797 Category:  PROGRAM-CONTROL
798
799 Reference:  PROG, RETURN, AGAIN
800
801      This FSUBR is identical to PROG (q.v.), except that it
802 does not bind LPROG\ !-INTERRUPTS, and therefore RETURNs and AGAINs will
803 not default to it.  This could prove useful to MACRO writers.
804
805 Argument:
806
807   Template:  #DECL ("VALUE" ANY "ARGS" <LIST ATOM LIST DECL ANY>)
808
809 Optional argument 1 -- An ATOM, to bind the activation of the BIND to.
810 Argument 2 -- A parameter LIST.
811 Optional argument 3 -- The DECL of the BIND.
812 Remainder of arguments -- At least one object, to be sequentially evaled.
813 Returns -- The last thing evaled in the BIND, or the argument to a
814         RETURN within the BIND.
815
816 Example:  <BIND ((C <OPEN "READ" "FOO BAR">))
817                 <COND (.C <FOO> <CLOSE .C>)>>
818 This will FOO only if the file FOO BAR exists.
819 \f
820 BITS:     Create a byte pointer.
821
822 Object-type:  SUBR
823
824 Category:  BIT-TWIDDLING
825
826 Reference:  GETBITS, PUTBITS
827
828      BITS creates a byte pointer to a word.  It takes two arguments, 
829 the second optional.  The first is the width of the byte in bits, the
830 second the right edge of the byte (counting from the least significant
831 bit of the word), which defaults to 0, meaning the rightmost bit.
832      A BITS is used with GETBITS and PUTBITS to get and put bytes from
833 objects of primtype WORD.
834
835 Argument:
836
837   Template:  #DECL ("VALUE" BITS FIX "OPTIONAL" FIX)
838
839 Argument 1 -- A FIX specifying the size of the byte pointed at.
840 (Optional)
841 Argument 2 -- A FIX specifying the right edge of the byte, default 0.
842 Returns -- A BITS, which may be used with GETBITS and PUTBITS to work
843         with bytes of actual machine words.
844
845 Example:  <BITS 36>
846 Points to a full PDP-10 word
847           <BITS 7 15>
848 Points to third Ascii character position in word
849 \f
850 BLOAT-STAT: Get internal storage statistics
851
852 Object-type:  SUBR
853
854 Category:  UTILITY
855
856 Reference:  BLOAT
857
858         BLOAT-STAT fills its argument uvector with information about
859 the state of storage.  The first 8 elements tell the number of GCs
860 attributable to various causes; the other 19 tell the sizes of various
861 areas of storage.  For details see the manual, SYS.11.01.
862
863 Argument:
864
865   Template:  #DECL ("VALUE" <UVECTOR [27 FIX]>
866                     "OPTIONAL" <UVECTOR [27 ANY]>)
867
868 (Optional)
869 Argument 1 -- a uvector of length 27 at least
870 Returns -- arg1 or a gratis uvector of storage statistics
871
872 Example:  <BLOAT-STAT>
873 If no arg, a uvector is provided gratis.
874 \f
875 BLOAT:    Temporarily grow the garbage collected space.
876
877 Object-type:  SUBR
878
879 Category:  ENVIRONMENT
880
881 Reference:  GC
882
883      BLOAT provides a mechanism for temporary growth of the MUDDLE
884 garbage collected space as well as various stacks and special data
885 structures.
886      BLOAT takes from 0 to 15 arguments all of type FIX.  The args are
887 described below in the Argument template field of this abstract.
888      Note that unless more than seven arguments are given, BLOAT will
889 not necessarily make any permanent change in the amount of space in
890 a MUDDLE -- the new space allocated may go away in the next following
891 GC if it is not filled.
892      BLOAT always returns the current number of free words.
893
894 Argument:
895
896   Template:  #DECL ("VALUE" FIX "OPTIONAL" FIX FIX FIX FIX FIX FIX FIX FIX FIX
897                     FIX FIX FIX FIX FIX FIX)
898
899 (Optional)
900 Argument 1 -- Free space desired.
901 Argument 2 -- Main stack space desired.
902 Argument 3 -- Top level local slots desired.
903 Argument 4 -- Global value slots desired.
904 Argument 5 -- New type slots desired.
905 Argument 6 -- Non garbage collected words needed (STORAGE).
906 Argument 7 -- Auxiliary stack space desired (only useful for reading
907         large strings).
908 Argument 8 -- Minimum space to get in all future GCs.
909 Argument 9 -- top-level local slots to add on future expansions
910 Argument 10 -- global-value slots to add on future expansions
911 Argument 11 -- type slots to add on future expansions
912 Argument 12 -- words of STORAGE to add on future expansions
913 Argument 13 -- words reserved for pure storage, if possible
914 Argument 14 -- most desirable size for auxiliary stack
915 Argument 15 -- most desirable size for main (control) stack
916
917 Example:  <BLOAT 10000 10000 100 100 100>
918 Get lots of free and stack space.
919 \f
920 BLOCK:    Change the current OBLIST path.
921
922 Object-type:  SUBR
923
924 Category:  ENVIRONMENT
925
926 Reference:  ENDBLOCK
927
928      BLOCK changes the current OBLIST path by pushing the binding
929 of the ATOM OBLIST, and rebinding it to the arg of BLOCK.
930      BLOCK takes as argument a LIST of OBLISTs, of which one is in
931 most cases the ROOT OBLIST.  An application of ENDBLOCK will return
932 the path to its previous state.
933
934 Argument:
935
936   Template:  #DECL ("VALUE" <OR OBLIST <LIST [REST <OR OBLIST 'DEFAULT>]>>
937                     <OR OBLIST <LIST [REST <OR OBLIST 'DEFAULT>]>>)
938
939 Argument 1 -- The new LIST of OBLISTs to become the new path.
940 Returns -- Its argument.
941
942 Example:  <BLOCK (<MOBLIST <PARSE <STRING !\I .FOO>> 23>
943                   <ROOT>)>
944
945 This is approximately what happens when the function RPACKAGE is
946 invoked.  It creates a new path containing the internal oblist of the
947 RPACKAGE plus the ROOT.
948 \f
949 BOUND?:   Is an Atom locally bound ?
950
951 Object-type:  SUBR
952
953 Category:  PREDICATE, IDENTIFIER
954
955 Reference:  ASSIGNED?
956
957      This routine is used to test if a particular Atom is locally
958 bound, or in other words if it either has a local value or else has a
959 local binding which has not yet been assigned, in a given environment,
960 default the current one.  It does cause the activation of any read
961 monitors on that local binding.
962      It returns T if the ATOM is locally bound, #FALSE() otherwise.
963
964 Argument:
965
966   Template:  #DECL ("VALUE" <OR 'T FALSE> ATOM "OPTIONAL"
967                     <OR ENVIRONMENT ACTIVATION FRAME PROCESS>)
968
969 Argument 1 -- An ATOM which may or may not have a local binding.
970 (Optional)
971 Argument 2 -- the environment in which to perform the test
972 Returns -- T if the ATOM has a local binding, #FALSE() otherwise.
973
974 Example:  <SET FOO "ANYTHING">
975           <BOUND? FOO>
976 This will return the Atom T, since FOO does have a local binding.
977           <UNASSIGN FOO>
978           <BOUND? FOO>
979 This will return #FALSE (), since the Atom FOO has no local binding.
980           <PROG (FOO) <BOUND? FOO>>
981
982 However this will also return the Atom T, since FOO does have a local
983 binding.
984 \f
985 BREAK-SEQ: Stack an object for another PROCESS to EVAL when it is RESUMEd
986
987 Object-type:  SUBR
988
989 Category:  PROCESS-CONTROL
990
991 Reference:  RESUME
992
993      Takes an object and a PROCESS, and stacks the object in the PROCESS
994 such that when RESUMEd, the PROCESS will EVAL it before doing what it
995 would normally do.  It thus 'breaks' the evaluation sequence in the
996 other PROCESS.  Objects are stacked in the new process, and thus the
997 last BREAK-SEQed will be the first EVALed.
998
999 Argument:
1000
1001   Template:  #DECL ("VALUE" PROCESS ANY PROCESS)
1002
1003 Argument 1 -- The object to be stacked.
1004 Argument 2 -- The PROCESS to stack it in.
1005 Returns -- The PROCESS in which the object was stacked.
1006
1007 Example:  <BREAK-SEQ '<+ 1 1> <RESUMER>>
1008 Give the PROCESS that resumed me something to do.
1009 \f
1010 BUFOUT:   Force out a channel's write buffer
1011
1012 Object-type:  SUBR
1013
1014 Category:  I/O
1015
1016 Reference:  OPEN, CLOSE, RESET
1017
1018      BUFOUT forces the buffers of a print channel out.  It is used
1019 primarily as insurance against system crashes and other acts of God,
1020 to assure that all of the data created by a process will be output.
1021      It takes and returns a CHANNEL.
1022
1023 Argument:
1024
1025   Template:  #DECL ("VALUE" CHANNEL "OPTIONAL" CHANNEL)
1026
1027 (Optional arguments)
1028 Argument 1 -- A print CHANNEL to force buffers from.
1029 Returns -- The CHANNEL.
1030
1031 Example:  <BUFOUT .OUTCHAN>
1032 Flush buffers from OUTCHAN.
1033 \f
1034 BYTE-SIZE:  Return the size of bytes of a BYTES
1035
1036 Object-type:  SUBR
1037
1038 Category:  TYPE
1039
1040 Reference:  BYTES, IBYTES
1041
1042      BYTE-SIZE returns the size of all the bytes of a BYTES.  This
1043 is the number of bits in all FIXes in the BYTES.
1044
1045 Argument:
1046
1047   Template:  #DECL ("VALUE" FIX <PRIMTYPE BYTES>)
1048       
1049 Argument 1 -- A BYTES
1050 Returns -- A FIX, which is the size of bytes of the BYTES.
1051
1052 Example:  <BYTE-SIZE #2 {}>
1053           2
1054 \f
1055 BYTES:    Create a BYTES from FIXes
1056
1057 Object-type:  SUBR
1058
1059 Category:  DATA-HANDLING
1060
1061 Reference:  IBYTES  
1062
1063    BYTES creates a byte-string with explicit elements.  These must be
1064 PRIMTYPE WORDs.  They will be ANDBed with the appropriate mask and
1065 concatenated together to form a new BYTES.
1066
1067 Argument:
1068
1069   Template:  #DECL ("VALUE" BYTES FIX "TUPLE" <TUPLE [REST <PRIMTYPE WORD>]>)
1070
1071 Argument 1 -- the number of bits in each byte
1072 Tuple of arguments -- PRIMTYPE WORDs, the elements of the new BYTES
1073 Returns -- Newly created BYTES
1074
1075 Example:  <BYTES 2 0 1 2 3 4 5 6>
1076           #2 {0 1 2 3 0 1 2}]
1077 \f
1078 CHANLIST: Get list of all open channels.
1079
1080 Object-type:  SUBR
1081
1082 Category:  I/O, UTILITY
1083
1084     Creates and returns a list of all OPEN channels in a MUDDLE.
1085 The first and second elements of this list are usually the TTY input
1086 and output channels of the MUDDLE.
1087
1088 Argument:
1089
1090   Template:  #DECL ("VALUE" <LIST [REST CHANNEL]>)
1091
1092 Returns -- A LIST of all the CHANNELs currently open in a MUDDLE.
1093
1094 Example:  <CHANLIST>
1095 Only possible example
1096 \f
1097 CHANNEL:  Create a CHANNEL.
1098
1099 Object-type:  SUBR
1100
1101 Category:  I/O
1102
1103 Reference:  OPEN
1104
1105      This SUBR is similar to OPEN, except that it only goes as far as
1106 creating the channel that OPEN would go on to OPEN.  Its advantage
1107 is that the CHANNEL returned can be RESET just as though it had once
1108 been open.
1109      It takes the identical arguments as OPEN but does not open the
1110 CHANNEL.  For greater detail, see the Abstract of OPEN.
1111
1112 Argument:
1113
1114   Template:  #DECL ("VALUE" CHANNEL "OPTIONAL" STRING
1115                     "TUPLE" TUPLE)
1116
1117 (Optional)
1118 Argument 1 -- A STRING giving the direction and type of OPEN to not do.
1119 Argument 2 -- STRINGs and/or FIXes giving the specification of the
1120      file to not OPEN.
1121 Returns -- An unOPENed CHANNEL.
1122
1123 Example:  <CHANNEL "PRINT" "FOO BAR">
1124 Return an unopened PRINT channel.
1125 \f
1126 CHTYPE:   Change the type of a MUDDLE object.
1127
1128 Object-type:  SUBR
1129
1130 Category:  TYPE-MANIPULATION
1131
1132      Changes the type of a MUDDLE object (or, more exactly, a given
1133 type-value pair).  The allowable changes are among types of the same
1134 PRIMTYPE.  For example, WORDs may be CHTYPEd to FIXes, but VECTORs may
1135 not be CHTYPEd to LISTs.  CHTYPE does not affect any other pointers to
1136 the object that may exist.
1137      Some objects which have the same primtype may not be CHTYPEd to
1138 each other, for example, a VECTOR may not be CHTYPEd to a CHANNEL.
1139 This is because some types (like CHANNEL) are controlled and may be
1140 created only in special ways.
1141      Takes as arguments the object to be CHTYPEd, and an ATOM giving
1142 the name of the type to CHTYPE it to.
1143
1144 Argument:
1145
1146   Template:  #DECL ("VALUE" ANY ANY ATOM)
1147
1148 Argument 1 -- Any (or almost any) object.
1149 Argument 2 -- An ATOM which is the name of a type.
1150 Returns -- Argument 1 with its type changed to type argument 2.
1151
1152 Example:  <SET X (+ 1 2)>
1153           (+ 1 2)
1154 Create a LIST
1155           <CHTYPE .X FORM>
1156           <+ 1 2>
1157 Returns a FORM
1158           .X
1159           (+ 1 2)
1160 But the original is untouched
1161 \f
1162 CHUTYPE:  Change the uniform type of a UVECTOR
1163
1164 Object-type:  SUBR
1165
1166 Category:  TYPE-MANIPULATION
1167
1168 Reference:  UTYPE?
1169
1170      CHUTYPE changes the uniform type (UTYPE) of a UVECTOR.  The
1171 types to which the UTYPE may be changed are restricted in the same way
1172 as the changes allowed by CHTYPE are restricted.  Thus a UVECTOR of
1173 UTYPE LIST cannot be changed to one of UTYPE VECTOR, but one of UTYPE
1174 FORM may be changed to one of UTYPE LIST.  A UTYPE of LOSE may be
1175 CHUTYPEd to anything that a UVECTOR may legally contain.
1176
1177 Argument:
1178
1179   Template:  #DECL ("VALUE" <PRIMTYPE UVECTOR>
1180                     <PRIMTYPE UVECTOR> ATOM)
1181
1182 Argument 1 -- A UVECTOR whose UTYPE wants to be changed.
1183 Argument 2 -- An ATOM whose name is the name of the type to change the
1184         UTYPE of the UVECTOR to.
1185 Returns -- The UVECTOR with a new UTYPE.
1186
1187 Example:  <SET X ![() () () () ()!]>
1188           <CHUTYPE .X FORM>
1189           ![<> <> <> <> <>!]
1190 New UTYPE.
1191           .X
1192           ![<> <> <> <> <>!]
1193 Note all references to UVECTOR get new UTYPE.
1194 \f
1195 CLOSE:    Close an I/O channel
1196
1197 Object-type:  SUBR
1198
1199 Category:  I/O
1200
1201 Reference:  OPEN, BUFOUT, RESET
1202
1203      CLOSE takes as argument a CHANNEL, and causes it to be closed.
1204 Its buffers are written out if it is a PRINT channel.  The channel
1205 may be reopened using RESET, for many types of devices.
1206       The CHANNEL closed is returned.
1207
1208 Argument:
1209
1210   Template:  #DECL ("VALUE" CHANNEL CHANNEL)
1211
1212 Argument 1 -- A CHANNEL to close.
1213 Returns -- The closed CHANNEL.
1214
1215 Example:  <RESET <CLOSE <OPEN "READ" "DSK:FOO BAR">>>
1216
1217 This pointless form will cause a CHANNEL to be opened (assuming the
1218 file exists), closed, and then reopened.
1219 \f
1220 CLOSURE:  Bind the free variables of a Function to current values
1221
1222 Object-type:  SUBR
1223
1224 Category:  TYPE-MANIPULATION
1225
1226      The CLOSURE Subr creates an object of Type CLOSURE.  A CLOSURE
1227 can be applied like a FUNCTION, the only difference being that first
1228 the Atoms given in the call to the CLOSURE subr are bound to the values
1229 thay had when the CLOSURE was generated.  Then the Function is applied
1230 as normal in this new environment.
1231      A CLOSURE is a poor man's FUNARG.
1232
1233 Argument:
1234
1235   Template:  #DECL ("VALUE" CLOSURE FUNCTION "TUPLE"
1236                     <TUPLE [REST ATOM]>)
1237
1238 Argument 1 -- A FUNCTION which will be the application part of the
1239         CLOSURE.
1240 Tuple of arguments -- ATOMs whose current values are to be stored as
1241         the binding part of the CLOSURE.
1242 Returns -- A CLOSURE.
1243
1244 Example:  <CLOSURE <FUNCTION (X) 
1245                            <SET .X <+ ..X .INC>>>
1246                    INC>
1247
1248 This will create a Closure which can later be applied to an Atom.
1249 When applied it will then increment the local value of that Atom.
1250 The amount of the increment is determined by the current value of INC.
1251 Note that any future changes to the value of INC will not affect
1252 the amount of the increment peformed by the Closure.
1253 \f
1254 COND:     CONDitional evaluation on the basis of a predicate
1255
1256 Object-type:  FSUBR
1257
1258 Category:  PREDICATE, PROGRAM-CONTROL
1259
1260 Reference:  AND, OR
1261
1262      COND is an FSUBR used to control evaluation on the basis of a
1263 number of predicates.  It takes any non-zero number of arguments, each
1264 of which is a list of a least one element.
1265      For each list, starting with the first, the first element of the
1266 list is evaluated, and if its result is non-false, the rest of the
1267 elements of that list are evaluated and the last thing returned by
1268 one of them is returned as the value of the COND (this will be the
1269 predicate itself if it is the only object in the list.
1270      If the predicate returns a FALSE, then COND moves on to the next
1271 list, or, if there are no more lists, the last FALSE returned is the
1272 value of the COND.
1273
1274 Argument:
1275
1276   Template:  #DECL ("VALUE" ANY "ARGS" <LIST LIST [REST LIST]>)
1277
1278 Tuple of arguments -- At least one list, of which the first element
1279         is the 'IF', and the rest the 'THEN'.
1280 Returns -- The result of the last EVAL under its control.
1281
1282 Example:  <COND (<SET C <OPEN "READ" "FOO BAR">>
1283                  <LOAD .C>
1284                  <CLOSE .C>)>
1285
1286 A common use of COND is to fend off the possibility of lossage by
1287 setting up a screen of conditions.  Note that if the file is not
1288 opened, the reason will be returned (the last FALSE).
1289 \f
1290 CONS:     Add an item to the front of a LIST
1291
1292 Object-type:  SUBR
1293
1294 Category:  DATA-HANDLING
1295
1296 Reference:  LIST
1297
1298      CONS adds an item to the front of a list, without copying it.
1299 It is equivalent to making a list of the new item and the old list
1300 segment evaled:
1301                 <CONS .FOO .THE-LIST>
1302                 (.FOO !.THE-LIST)
1303 are the same.  In fact, the segment evaluation method is preferred, as
1304 it is compilable into a PUSHJ.
1305
1306 Argument:
1307
1308   Template:  #DECL ("VALUE" LIST ANY LIST)
1309
1310 Argument 1 -- An object.
1311 Argument 2 -- A LIST to which the object should be prefixed.
1312 Return -- A new list which points into the old one -- the old one is
1313         NOT recopied.
1314
1315 Example:  <CONS 1 (2 3 4)>
1316 note that this is equivalent to (1 !'(2 3 4))
1317 \f
1318 COS:      Cosine of an angle
1319
1320 Object-type:  SUBR
1321
1322 Category:  ARITHMETIC
1323
1324 Reference:  SIN, ATAN
1325
1326
1327 Argument:
1328
1329   Template:  #DECL ("VALUE" FLOAT <OR FIX FLOAT>)
1330
1331 Argument 1 -- the angle in radians.
1332 Returns -- A FLOAT, the Cosine.
1333
1334 Example:  <+ <* <COS .X> <COS .X>>
1335              <* <SIN .X> <SIN .X>>>
1336           1.0
1337 One of the common trig. identities.
1338 \f
1339 CRLF:     Print a carriage-return and line-feed
1340
1341 Object-type:  SUBR
1342
1343 Category:  I/O
1344
1345 Reference:  TERPRI
1346
1347
1348 Argument:
1349
1350   Template:  #DECL ("VALUE" 'T "OPTIONAL" CHANNEL)
1351
1352 (Optional)
1353 Argument 1 -- the channel, default .OUTCHAN
1354 Returns -- T
1355
1356 Example:  <CRLF>
1357           T
1358 Output carriage-return and line-feed.
1359 \f
1360 DECL-CHECK: Change or examine the state of DECL checking
1361
1362 Object-type:  SUBR
1363
1364 Category:  TYPE, UTILITY
1365
1366      Changes the state of MUDDLE's DECL checking.  Initially turned
1367 on, it may be disabled by <DECL-CHECK #FALSE()>, or enabled by
1368 <DECL-CHECK T>.  When enabled, each attempt to set an ATOM is checked
1369 against any available DECL of that ATOM.  An ERROR is generated if the
1370 DECL does not match the value to which the ATOM will be set.
1371
1372 Argument:
1373
1374   Template:  #DECL ("VALUE" <OR FALSE ANY>
1375                     "OPTIONAL" <OR FALSE ANY>)
1376
1377 (Optional)
1378 Argument 1 -- Any MUDDLE object.  Non-false to enable DECL checking,
1379         False to disable it.
1380 Returns -- The old state.
1381
1382 Example:  <DECL-CHECK T>
1383 Enables DECL checking.
1384 \f
1385 DECL?:    Check an object against a DECL Pattern
1386
1387 Object-type:  SUBR
1388
1389 Category:  DATA-HANDLING, PREDICATE
1390
1391         DECL? is a predicate that tells whether or not an object
1392 satisfies a type/structure declaration.
1393
1394 Argument:
1395
1396   Template:  #DECL ("VALUE" <OR 'T FALSE>
1397                     ANY <OR ATOM <FORM 'QUOTE FORM>>)
1398
1399 Argument 1 -- an object to be checked
1400 Argument 2 -- a QUOTEd Pattern to check it against
1401 Returns -- T or a FALSE
1402
1403 Example:  <DECL? '[1 2 3] '<VECTOR [REST FIX]>>
1404           T
1405 note QUOTE on Pattern
1406 \f
1407 DEFINE:   Define a FUNCTION
1408
1409 Object-type:  FSUBR
1410
1411 Category:  DATA-HANDLING
1412
1413 Reference:  FUNCTION, DEFMAC
1414
1415      DEFINE sets the global value of an atom to the function it
1416 creates from the rest of the arguments.  It also checks to see if the
1417 atom was already 'defined', if so and if the atom REDEFINE is non
1418 false, it complains.  Otherwise this fsubr operates like FUNCTION plus
1419 SETG.
1420
1421 Argument:
1422
1423   Template:  #DECL ("VALUE" ATOM ATOM "ARGS" LIST)
1424
1425 Argument 1 -- The atom whose GVAL to make the function.
1426 List of arguments -- If the first element of the list is an atom the
1427         activation is bound to it, the rest is the arg list, DECL, and
1428         body of the function.
1429 Returns -- Argument 1.
1430
1431 Example:  <DEFINE FACTORIAL (N) 
1432                   <COND
1433                    (<0? .N> 1)
1434                    (T
1435                     <* .N
1436                        <FACTORIAL <- .N 1>>>)>>
1437 Then <FACTORIAL 4> returns 24
1438 \f
1439 DEFMAC:   Define an EVAL Macro
1440
1441 Object-type:  FSUBR
1442
1443 Category:  IDENTIFIER
1444
1445 Reference:  DEFINE, EXPAND
1446
1447      DEFMAC is syntactically exactly the same as DEFINE.  However,
1448 instead of creating a FUNCTION, DEFMAC creates a MACRO.  A MACRO is
1449 of primtype LIST, and in fact has a FUNCTION (or other applicable type)
1450 as its single element.
1451      MACROs are applied in a funny way, however.  It is EVALed
1452 twice.  The first EVAL causes the macro's element to be applied to the
1453 macro's arguments. Whatever it returns (usually another form) is also
1454 evaled, and the result of the second evaluation is the result of
1455 applying the macro.
1456      To avoid complications, the first eval (to create the object to
1457 be evaled in the second...) is done at top-level.  The result of this
1458 policy is that two syntactically identical invocations of a macro
1459 should always return the same thing to be evaled in the second EVAL.
1460      EXPAND (qv) is used to perform the first EVAL without the second.
1461
1462 Argument:
1463
1464   Template:  #DECL ("VALUE" ATOM ATOM "ARGS" LIST)
1465
1466 Argument 1 -- The atom whose GVAL is to be the MACRO.
1467 Argument 2 -- The parameter list.
1468 Tuple of arguments -- The body of the macro.
1469 Returns -- Argument 1.
1470
1471 Example:  <DEFMAC INC (ATM "OPTIONAL" (N 1)) 
1472                   <FORM SET
1473                         .ATM
1474                         <FORM +
1475                               <FORM LVAL .ATM>
1476                               .N>>>
1477           <SET X 1>
1478           1
1479           <INC X>
1480           2
1481           <EXPAND '<INC X>>
1482           <SET X <+ .X 1>>
1483 The standard INC hack, in EVAL-macro form.
1484 \f
1485 DEMSIG:   Signal a system Daemon
1486
1487 Object-type:  SUBR
1488
1489 Category:  SYSTEM
1490
1491      DEMSIG signals to a system Daemon that it should run.  It takes
1492 a STRING, which is the name of the Daemon in the system's tables, and
1493 causes a signal to it to be sent.
1494      Returns T if the Daemon exists, FALSE otherwise.
1495
1496 Argument:
1497
1498   Template:  #DECL ("VALUE" <OR 'T FALSE> STRING)
1499
1500 Argument 1 -- A STRING giving the name of a Daemon.
1501 Returns -- T if exists, FALSE otherwise.
1502
1503 Example:  <DEMSIG "COMDMN">
1504 Signal the communication Daemon.
1505 \f
1506 DISABLE:  Disable an interrupt
1507
1508 Object-type:  SUBR
1509
1510 Category:  INTERRUPT
1511
1512 Reference:  ENABLE
1513
1514      DISABLE causes the interrupt associated with the IHEADER which
1515 is its argument to be disabled.  Disabled interrupts are ignored as
1516 opposed to queued.
1517
1518 Argument:
1519
1520   Template:  #DECL ("VALUE" IHEADER IHEADER)
1521
1522 Argument 1 -- The IHEADER whose interrupt is to be disabled.
1523 Returns -- Argument 1.
1524
1525 Example:  <DISABLE <GET .INCHAN INTERRUPT>>
1526 Disable the ^G and ^S interrupts.
1527 \f
1528 DISMISS:  Dismiss an interrupt
1529
1530 Object-type:  SUBR
1531
1532 Category:  INTERRUPT
1533
1534 Reference:  INT-LEVEL, HANDLER
1535
1536      DISMISS allows an interrupt handler to dismiss an interrupt
1537 returning a value, to an arbitrary activation, at an arbitrary int-
1538 level.  Only the value is required.  If the activation is not given
1539 the return is to the place interrupted from.  If the int-level is not
1540 given, the int-level is restored to what it was prior to the invocation
1541 of the HANDLER.
1542
1543 Argument:
1544
1545   Template:  #DECL ("VALUE" ANY ANY "OPTIONAL" ACTIVATION FIX)
1546
1547 Argument 1 -- The value.
1548 (Optional)
1549 Argument 2 -- The activation to return the value from.  Default, the
1550         place from which the HANDLER was invoked.
1551 Argument 3 -- The interrupt level to set on return.  Default the one
1552         prior to invocation of the HANDLER.
1553 Returns -- The first argument.
1554
1555 Example:  <DISMISS #FALSE ("FATAL ERROR DEEP IN GUTS")
1556                    .TOP-LEVEL-ACTIVATION>
1557
1558 A construct like this could be used to signal to a higher level that
1559 somewhere in the code below it, a fatal error occured.
1560 \f
1561 DISPLAY:  Display a PICTURE on a Display Channel            [OBSOLETE]
1562
1563         ******* This SUBR is obsolete as of MUD55 *******
1564
1565 Object-type:  SUBR
1566
1567 Category:  GRAPHICS
1568
1569 Reference:  ERASE, OPEN, 
1570             MUDDLE GRAPHICS USER'S MANUAL, SYS.11.04, Bruce Daniels, Ed Black
1571
1572      DISPLAY takes two arguments, a CHANNEL opened in DISPLAY mode,
1573 and a PICTURE.  The picture is displayed on the device associated with
1574 the display channel.  If no second argument is given, the display on
1575 that device will be refreshed.  This is useful if the device is a
1576 display console such as an IMLAC or ARDS.
1577
1578 Argument:
1579
1580   Template:  #DECL ("VALUE" CHANNEL CHANNEL "OPTIONAL" PICTURE)
1581
1582 Argument 1 -- A CHANNEL open in display mode.
1583 (Optional)
1584 Argument 2 -- A PICTURE to display on the CHANNEL.  If not given, the
1585         display is refreshed only.
1586 Returns -- The CHANNEL.
1587
1588 Example:  <SET D <OPEN "DISPLAY" "E&S:">>
1589           <DISPLAY .D .PIC>
1590 Where PIC is a Picture created previously in some manner.
1591 \f
1592 ECHOPAIR: Pair up console channels for echoing
1593
1594 Object-type:  SUBR
1595
1596 Category:  I/O
1597
1598         ECHOPAIR makes its two argument channels 'know about each other'
1599 so that rubout, ^@, ^D, and ^L will work between them.
1600
1601 Argument:
1602
1603   Template:  #DECL ("VALUE" CHANNEL CHANNEL CHANNEL)
1604
1605 Argument 1 -- console-input channel
1606 Argument 2 -- console-output channel
1607 Returns -- arg1
1608
1609 Example:  <ECHOPAIR .INCHAN .OUTCHAN>
1610 what LISTEN does
1611 \f
1612 EMPTY?:   Does a structure have zero elements ?
1613
1614 Object-type:  SUBR
1615
1616 Category:  PREDICATE, DATA-HANDLING
1617
1618 Reference:  MONAD?
1619
1620      This routine tests if a given structured object has a length of
1621 zero.  Note that EMPTY? works correctly for circular Lists, which have
1622 no well-defined length.
1623
1624 Argument:
1625
1626   Template:  #DECL ("VALUE" <OR 'T FALSE> STRUCTURED)
1627
1628 Argument 1 -- Any structured object.
1629 Returns -- T if the structured object has no elements, #FALSE () if it
1630         has any elements at all.
1631
1632 Example:  <EMPTY? "---args---">
1633 This will return #FALSE ().
1634           <EMPTY? ()>
1635 However, this will return T.
1636 \f
1637 ENABLE:   Enable an interrupt
1638
1639 Object-type:  SUBR
1640
1641 Category:  INTERRUPT
1642
1643 Reference:  DISABLE
1644
1645      ENABLE causes the interrupt associated with the IHEADER which is
1646 its argument to be enabled.  This causes the interrupt HANDLERS
1647 associated with the IHEADER to be run when the interrupt occurs.
1648      ENABLEing an already enabled interrupt does nothing.
1649
1650 Argument:
1651
1652   Template:  #DECL ("VALUE" IHEADER IHEADER)
1653
1654 Argument 1 -- An IHEADER whose interrupt is to be enabled.
1655 Returns -- Argument 1.
1656
1657 Example:  <ENABLE <GET CLOCK!-INTERRUPTS INTERRUPT>>
1658 Enable a clock interrupt.
1659 \f
1660 ENDBLOCK: Undoes the effect of BLOCK, returning a previous OBLIST path
1661
1662 Object-type:  SUBR
1663
1664 Category:  IDENTIFIER, ENVIRONMENT
1665
1666 Reference:  BLOCK
1667
1668      ENDBLOCK pops a value of the ATOM OBLIST, returning the OBLIST
1669 path to a previous state.  It therefore undoes the effect of a BLOCK.
1670      If no BLOCK has been done, produces an ERROR.
1671      It returns the new OBLIST path.
1672
1673 Argument:
1674
1675   Template:  #DECL ("VALUE"
1676                     <OR OBLIST <LIST [REST <OR OBLIST 'DEFAULT>]>>)
1677
1678 Returns -- The previous OBLIST path, now restored.
1679
1680 Example:  <ENDBLOCK>
1681 Only possible example.
1682 \f
1683 ENTRY-LOC: Return the offset of an RSUBR-ENTRY
1684
1685 Object-type:  SUBR
1686
1687 Category:  DATA-HANDLING
1688
1689 Reference:  RSUBR-ENTRY, RSUBR
1690
1691      This routine will return the offset of an RSUBR-ENTRY into an
1692 RSUBR.  This will be the same offset that was supplied to create the
1693 RSUBR-ENTRY.
1694
1695 Argument:
1696
1697   Template:  #DECL ("VALUE" FIX RSUBR-ENTRY)
1698
1699 Argument 1 -- An RSUBR-ENTRY whose offset is to be returned.
1700 Returns -- A FIX, the offset of the RSUBR-ENTRY in its RSUBR.
1701
1702 Example:  <ENTRY-LOC <RSUBR-ENTRY [,FOO FOO1] 347>>
1703           347
1704 This will return the offset given to RSUBR-ENTRY, which is the 347.
1705 \f
1706 EQVB:     Bitwise logical EQV of its arguments
1707
1708 Object-type:  SUBR
1709
1710 Category:  LOGICAL, BIT-TWIDDLING
1711
1712 Reference:  ANDB, ORB, XORB
1713
1714      EQVB takes any number of arguments of Primtype WORD, and returns
1715 a WORD that is their bitwise logical EQV, that is, the bits they have
1716 in common.
1717
1718 Argument:
1719
1720   Template:  #DECL ("VALUE" WORD <TUPLE [REST <PRIMTYPE WORD>]>)
1721
1722 Tuple of arguments -- Primtype WORDs to be EQVed together.
1723 Returns -- A WORD.
1724
1725 Example:  <EQVB -22906492246 22906492245>
1726           #WORD *000000000000*
1727 No bits in common.
1728 \f
1729 ERASE:    Erase a picture from a Display Channel            [OBSOLETE]
1730
1731         ******* This SUBR is obsolete as of MUD55 *******
1732
1733 Object-type:  SUBR
1734
1735 Category:  GRAPHICS
1736
1737 Reference:  DISPLAY, OPEN, 
1738             MUDDLE GRAPHICS USER'S MANUAL, SYS.11.04, Bruce Daniels, Ed Black
1739
1740      ERASE takes two arguments, the second optional.  The first is a
1741 CHANNEL open in Display mode.  The second is a picture.  ERASE causes
1742 the picture to be removed from the display on that CHANNEL.  If the
1743 second argument is not given, all the pictures on that CHANNEL will be
1744 removed, leaving an empty display.
1745
1746 Argument:
1747
1748   Template:  #DECL ("VALUE" CHANNEL CHANNEL "OPTIONAL" PICTURE)
1749
1750 Argument 1 -- A CHANNEL open in display mode.
1751 (Optional)
1752 Argument 2 -- A PICTURE to erase from the CHANNEL.  If not given, all
1753         of the pictures on the CHANNEL are ERASEd.
1754 Returns -- The CHANNEL.
1755
1756 Example:  <SET D <OPEN "DISPLAY" "E&S:">>
1757           <DISPLAY .D .PIC>
1758           <ERASE .D .PIC>
1759
1760 Display PIC and then remove it.  (Where PIC is a Picture created
1761 previously in some manner).
1762 \f
1763 ERRET:    Return a value as the value of a FRAME
1764
1765 Object-type:  SUBR
1766
1767 Category:  PROGRAM-CONTROL
1768
1769 Reference:  RETRY, RETURN
1770
1771      ERRET is used to return values from FRAMEs.  It takes two
1772 optional arguments, a value to return, and a FRAME.  If defaulted,
1773 the FRAME is the frame of the last invocation of ERROR or LISTEN, and
1774 if both are defaulted, it means to return to TOPLEVEL and reenter the
1775 LISTEN loop there.
1776      ERRET is used most often to recover from errors, by returning
1777 a reasonable argument from the frame that called ERROR.
1778
1779 Argument:
1780
1781   Template:  #DECL ("VALUE" ANY "OPTIONAL" ANY FRAME)
1782
1783 (Optional)
1784 Argument 1 -- The value to return from the FRAME given in arg2.
1785 Argument 2 -- The FRAME from which to return the value given.
1786 Returns -- Argument 1.
1787
1788 Example:  <ERRET T>
1789
1790 Single most common use of ERRET -- continue from REDEFINE ERROR,
1791 return something innocuous as value of funny atom, and so on.
1792 \f
1793 ERROR:    Announce an ERROR
1794
1795 Object-type:  SUBR
1796
1797 Category:  ERROR
1798
1799 Reference:  ERRET
1800
1801      ERROR is used to announce an ERROR in a program.  It takes any
1802 number of arguments, which will be printed as ERROR recurses to a
1803 higher level LISTEN loop.
1804      The usual format is to give an ATOM which is the reason for the
1805 ERROR, the routine in which it occurred, and any other information of
1806 interest last.
1807
1808 Argument:
1809
1810   Template:  #DECL ("VALUE" ANY "TUPLE" TUPLE)
1811
1812 Tuple of arguments -- ANY number of arguments of any type.
1813 Returns -- Whatever the user ERRETs from it.
1814
1815 Example:  <ERROR RAN-OUT-OF-INPUT!-ERRORS INPUT-HANDLER>
1816 Most common ERROR call format is this.
1817 \f
1818 ERRORS:   Returns the ERRORS OBLIST
1819
1820 Object-type:  SUBR
1821
1822 Category:  ERROR
1823
1824 Reference:  ERROR, ROOT
1825
1826      ERRORS returns the ERRORS OBLIST.  This is the OBLIST on which
1827 live the ATOMs whose PNAMEs are the MUDDLE ERROR messages.
1828
1829 Argument:
1830
1831   Template:  #DECL ("VALUE" OBLIST)
1832
1833 Returns -- The ERRORS OBLIST.
1834
1835 Example:  <ERRORS>
1836 Only possible example.
1837 \f
1838 EVAL:     Evaluate an expression in a given envirnoment
1839
1840 Object-type:  SUBR
1841
1842 Category:  PROGRAM-CONTROL
1843
1844   EVAL is a program control subr.  The first arg to EVAL is the MUDDLE
1845 expression to be evaluated.  The second, optional, arg is the execution
1846 environment in which the evaluation is to take place.  If the second
1847 arg is not supplied the current environment of the current process will
1848 be used.
1849   Every Type in MUDDLE has a defined, or default, rule for evaluation
1850 of MUDDLE objects of that Type.  See EVALTYPE on how to change these
1851 rules.
1852   The initial EVAL rules for MUDDLE Types are:
1853
1854 FORM--
1855     EVAL of empty FORM is #FALSE ()
1856     If <1 <-Form-> > is an ATOM,
1857         then, APPLY either GVAL of Atom or VALUE of the Atom to the
1858              appropriately EVALed or unEVALed args.
1859         else, APPLY the EVAL of <1 <-Form-> > to the appropriately EVALed
1860              or unEVALed args.
1861         Note that the subsequent EVAL of an arg which is of Type SEGMENT
1862         is treated specially.
1863
1864 LIST or VECTOR or UVECTOR--
1865         make a new structured object of the same Type whose elements
1866         are the EVALuated elements of the given object.
1867         Note that the EVAL of an element of the structure
1868         which is of Type SEGMENT is also treated specially.
1869
1870 ALL other types--
1871         Evaluate to themselves.
1872
1873 Argument:
1874
1875   Template:  #DECL ("VALUE" ANY ANY "OPTIONAL"
1876                     <OR ACTIVATION FRAME ENVIRONMENT PROCESS>)
1877
1878 Argument 1 -- ANY object to be EVALed.
1879 (Optional)
1880 Argument 2 -- An ACTIVATION, FRAME, ENVIRONMENT, or PROCESS in which
1881     to perform the evaluation.
1882 Returns -- The result of the EVAL, as described above.
1883
1884 Example:  <EVAL '<SET X <+ .X 1>> <RESUMER>>
1885
1886      This will increment the local value of the Atom X in the process
1887 which last resumed the current process.
1888      Note that the value of X in the current process, if any, will not
1889 be affected.
1890 \f
1891 EVALTYPE: Change or examine the way a TYPE is EVALed
1892
1893 Object-type:  SUBR
1894
1895 Category:  TYPE-MANIPULATION, PROGRAM-CONTROL
1896
1897 Reference:  EVAL, APPLYTYPE
1898
1899      Changes the way a specific type is EVALed, by either mapping
1900 it into another type, or giving an explicit method via an APPLICABLE.
1901      If a type is given, the type being changed will be EVALed in the
1902 same manner as that type.
1903      If an APPLICABLE is given, it should take one argument,
1904 which will be the object being EVALed.  Whatever the APPLICABLE returns
1905 will be the result of the EVALuation.  If ,EVAL is given, the type
1906 will hereafter receive no special treatment in evaluation.
1907      If no second arg is given, EVALTYPE returns the last second arg
1908 that was given for this type, or #FALSE () if the type is receiving no
1909 special treatment in evaluation.
1910
1911 Argument:
1912
1913   Template:  #DECL ("VALUE" <ATOM APPLICABLE FALSE> ATOM "OPTIONAL"
1914                     <OR ATOM APPLICABLE>)
1915
1916 Argument 1 -- The type whose EVALTYPE to change or examine.
1917 (Optional)
1918 Argument 2 -- A TYPE (which means 'Eval like this type'), or an
1919         APPLICABLE (meaning 'use this when you EVAL this type').
1920 Returns -- The TYPE which was changed or, if no arg 2, the special
1921         treatment it is receiving if any.
1922
1923 Example:  <EVALTYPE LIST FORM>
1924           <EVALTYPE ATOM ,LVAL>
1925           <SETG CAR 1>
1926           <SETG CDR ,REST>
1927           <SETG LAMBDA ,FUNCTION>
1928 This will set up MUDDLE to look like LISP to the casual user:
1929           (+ 1 2)
1930           3
1931           (SET 'A 5)
1932           5
1933           A
1934           5
1935 LISP in MUDDLE?
1936 \f
1937 EVENT:    Set up an IHEADER for an event
1938
1939 Object-type:  SUBR
1940
1941 Category:  INTERRUPT
1942
1943 Reference:  DISABLE, ENABLE
1944
1945      EVENT sets up an IHEADER for either an external or internal
1946 interrupt.  No handlers are attached to the IHEADER set up by EVENT.
1947      The first argument to EVENT identifies the interrupt.  It may be
1948 a string or an atom on the INTERRUPTS OBLIST.  In either case if the
1949 name is associated with a physical interrupt, the real interrupt is
1950 set up.  The first argument may also be a previously OFFd IHEADER.
1951      The second argument is the priority of this interrupt and it must
1952 be a positive fixed point number.  The priority basically specifies
1953 how important this interrupt is relative to other interrupts.
1954      If the first argument to EVENT is either CHAR!-INTERRUPTS,
1955 READ!-INTERRUPTS or WRITE!-INTERRUPTS or the strings with those names,
1956 a third argument is required.  For CHAR this must be a TTY input
1957 channel and for the others it must be the locative getting the READ or
1958 WRITE monitor.
1959
1960 Argument:
1961
1962   Template:  #DECL ("VALUE" IHEADER <OR STRING ATOM IHEADER> FIX
1963                     "OPTIONAL" <OR CHANNEL LOCATIVE>)
1964
1965 Argument 1 -- The name of the interrupt.
1966 Argument 2 -- A priority.
1967 (Optional)
1968 Argument 3 -- A CHANNEL, for character interrupts, or LOCATIVE, for monitors
1969 Returns -- An IHEADER.
1970
1971 Example:  <SET TEM <EVENT "SYSDOWN" 1>>
1972 Setup a SYSDOWN interrupt.
1973 \f
1974 EXP:      Exponents of 'e'
1975
1976 Object-type:  SUBR
1977
1978 Category:  ARITHMETIC
1979
1980 Reference:  LOG
1981
1982      EXP is the opposite of LOG, taking e to a power.  It takes a FIX
1983 or FLOAT as argument, and returns e to that power, converted to a FLOAT
1984 whether the argument was fix or float.
1985
1986 Argument:
1987
1988   Template:  #DECL ("VALUE" FLOAT <OR FIX FLOAT>)
1989
1990 Argument 1 -- A FIX or FLOAT to take e to the power of.
1991 Returns -- (e ** <argument 1>)
1992
1993 Example:  <EXP <LOG 2>>
1994           2.0
1995 Note conversion to floating point number.
1996 \f
1997 EXPAND:   Expand a MACRO  
1998
1999 Object-type:  SUBR
2000
2001 Category:  ENVIRONMENT, UTILITY
2002
2003 Reference:  DEFMAC
2004
2005 EXPAND evaluates its argument in a top-level environment, that is, as
2006 if no LVALs existed.  It is designed to perform the first evaluation
2007 in a MACRO application, but it can be useful in other cases.
2008
2009 Argument:
2010
2011   Template:  #DECL ("VALUE" ANY ANY)
2012
2013 Argument 1 -- an object to evaluate
2014 Returns -- the top-level value of the object or 'body' of the MACRO
2015
2016 Example:  <DEFMAC INC (ATM "OPTIONAL" (N 1)) 
2017                   <FORM SET
2018                         .ATM
2019                         <FORM +
2020                               <FORM LVAL .ATM>
2021                               .N>>>
2022           INC
2023           <EXPAND '<INC X>>
2024           <SET X <+ .X 1>>
2025 Note that <EVAL '<INC X>> would EVAL this last form too.
2026 \f
2027 FILE-EXISTS?: Check for existence of a file
2028
2029 Object-type:  SUBR
2030
2031 Category:  I/O
2032
2033 Reference:  OPEN
2034
2035         FILE-EXISTS? takes arguments like the second and higher arguments
2036 to OPEN (q.v.).  It returns T if the file thus specified exists, otherwise
2037 a FALSE of two elements: the error message and error code returned by the
2038 operating system.
2039
2040 Argument:
2041
2042   Template:  #DECL ("VALUE" <OR FALSE ATOM> "TUPLE" <REST STRING>)
2043
2044 Argument 1-4 -- file names
2045 Returns -- T if file exists, a FALSE otherwise
2046
2047 Example:  <FILE-EXISTS? "DSK:FOO;.FILE. (DIR)">
2048 Will return T if FOO is a real directory.
2049 \f
2050 FILE-LENGTH: Get length of input file
2051
2052 Object-type:  SUBR
2053
2054 Category:  I/O
2055
2056 Reference:  FILECOPY
2057
2058         FILE-LENGTH tells the length (in characters or binary words,
2059 depending on the channel's mode) of the disk file open for input on its
2060 argument channel.
2061
2062 Argument:
2063
2064   Template:  #DECL ("VALUE" FIX CHANNEL)
2065
2066 Argument 1 -- input disk channel
2067 Returns -- length of disk file
2068
2069 Example:  <ACCESS .IN <FILE-LENGTH .IN>>
2070 Next input will detect end of file.
2071 \f
2072 FILECOPY: Copy entire file from one channel to another
2073
2074 Object-type:  SUBR
2075
2076 Category:  I/O
2077
2078 Reference:  FILE-LENGTH
2079
2080         FILECOPY copies characters from an input channel (arg1) to an
2081 output channel (arg2) until the end of file, thus closing the input
2082 channel.  A FILE-LENGTH on arg1 must win, ruling out certain devices.
2083
2084 Argument:
2085
2086   Template:  #DECL ("VALUE" FIX "OPTIONAL" CHANNEL CHANNEL)
2087
2088 (Optional)
2089 Argument 1 -- source (input) channel, default .INCHAN
2090 Argument 2 -- destination (output) channel, default .OUTCHAN
2091 Returns -- number of characters copied
2092
2093 Example:  <FILECOPY <OPEN "READ" "TTY:.FILE. (DIR)">>
2094 like Monit's WHO
2095 \f
2096 FIX:      Convert a FLOAT to a FIX
2097
2098 Object-type:  SUBR
2099
2100 Category:  TYPE-MANIPULATION, ARITHMETIC
2101
2102 Reference:  FLOAT
2103
2104      FIX takes a FLOAT and converts it to a FIX, truncating the
2105 fractional part.
2106
2107 Argument:
2108
2109   Template:  #DECL ("VALUE" FIX <OR FLOAT FIX>)
2110
2111 Argument 1 -- A FLOAT to convert
2112 Returns -- A FIX corresponding to the FLOAT.
2113
2114 Example:  <FIX 69.910496>
2115           69
2116 Note the truncating.
2117 \f
2118 FLATSIZE: Return the size of an object within a maximum
2119
2120 Object-type:  SUBR
2121
2122 Category:  DATA-HANDLING, I/O
2123
2124 Reference:  PRINT
2125
2126      FLATSIZE returns the number of characters needed to PRINT an
2127 item, if it is less than the bound (thus winning on self-referencing things).
2128 If it is greater than the upper bound, returns #FALSE ().
2129
2130 Argument:
2131
2132   Template:  #DECL ("VALUE" <OR FALSE FIX> ANY FIX "OPTIONAL" FIX)
2133
2134 Argument 1 -- The object to 'PRINT'.
2135 Argument 2 -- The upper bound on size of the object.
2136 (Optional)
2137 Argument 3 -- radix for FIX conversion
2138 Returns -- The size, if less than the bound, or #FALSE () if not.
2139
2140 Example:  <FLATSIZE (1 2 3) 10>
2141 Will be a fix result
2142           <FLATSIZE (1 2 3) 5>
2143 Will be a FALSE
2144 \f
2145 FLOAD:    READ and EVAL every object in a file
2146
2147 Object-type:  SUBR
2148
2149 Category:  I/O
2150
2151 Reference:  READ, EVAL, LOAD, UNWIND, OPEN
2152
2153         FLOAD opens a file, READs and EVALs every object in it, and
2154 closes it again.  If the opening fails, an ERROR occurs, giving the
2155 reason for failure.  A (list of) oblist(s) may also be given for
2156 looking up atoms.  Control characters in the file have no special
2157 meaning.  An UNWIND is set up to close the channel on any ERRET.
2158
2159 Argument:
2160
2161   Template:  #DECL ("VALUE" '"DONE" "TUPLE" TUPLE)
2162
2163 (Optional)
2164 Tuple of arguments -- string(s) as for OPEN and/or oblist as for READ
2165 Returns -- "DONE"
2166
2167 Example:  <FLOAD "MUDDLE;FIXUP">
2168 part of initialization for TS file
2169 \f
2170 FLOAT:    Convert a FIX to a FLOAT
2171
2172 Object-type:  SUBR
2173
2174 Category:  TYPE-MANIPULATION, ARITHMETIC
2175
2176 Reference:  FIX
2177
2178
2179 Argument:
2180
2181   Template:  #DECL ("VALUE" FLOAT <OR FIX FLOAT>)
2182
2183 Argument 1 -- A FIX to convert to a FLOAT.
2184 Returns -- The new FLOAT.
2185
2186 Example:  <FLOAT 69>
2187           69.0
2188 CHTYPE would lose, of course.
2189 \f
2190 FORM:     Create a FORM with explicit arguments
2191
2192 Object-type:  SUBR
2193
2194 Category:  DATA-HANDLING
2195
2196 Reference:  IFORM
2197
2198      FORM creates a FORM of explicit arguments.  This is the way to
2199 make a form with the elements evaluated.
2200
2201 Argument:
2202
2203   Template:  #DECL ("VALUE" FORM "TUPLE" <TUPLE [REST ANY]>)
2204
2205 Tuple of arguments -- Any objects, the elements of the FORM.
2206 Returns -- The FORM created.
2207
2208 Example:  <DEFINE INCR (N) 
2209                   <FORM SET
2210                         .N
2211                         <FORM + 1 <FORM LVAL .N>>>>
2212 this returns the form <SET FOO <+ 1 .FOO>> when called with FOO as arg
2213 \f
2214 FRAME:    Walk the chain of stack frames
2215
2216 Object-type:  SUBR
2217
2218 Category:  ENVIRONMENT, UTILITY
2219
2220 Reference:  FUNCT, ARGS
2221
2222      FRAME returns the 'previous' stack-frame on the stack.  This
2223 means that given a FRAME, it returns the FRAME that generated it.  If
2224 no FRAME is given, it returns the topmost FRAME on the stack.
2225 Given an ACTIVATION or ENVIRONMENT, it returns the appropriate FRAME.
2226      When the stack 'runs out', i.e., the end is reached, it returns
2227 #FRAME TOPLEVEL.
2228      In conjunction with ARGS and FUNCT, makes a powerful debugging
2229 aid.
2230      FRAME, ARGS, and FUNCT may also get access to the stack frames
2231 of other processes, by giving the process as an argument.  If this
2232 feature is used, returns the topmost FRAME of that process.
2233
2234 Argument:
2235
2236   Template:  #DECL ("VALUE" FRAME
2237                     "OPTIONAL" <OR ENVIRONMENT
2238                                    ACTIVATION
2239                                    FRAME
2240                                    PROCESS>)
2241
2242 (Optional)
2243 Argument 1 -- Either nothing, meaning return topmost FRAME of this
2244         PROCESS, or a FRAME, meaning return next FRAME of this PROCESS,
2245         or an environment, meaning return topmost FRAME of this
2246         environment.
2247 Returns -- As described above, a FRAME, or #FRAME TOPLEVEL when the
2248         end of the stack is reached.
2249
2250 Example:  <DEFINE FRAMES ("OPTIONAL" (PROC <ME>)) 
2251                   <REPEAT ((X <FRAME .PROC>)
2252                            (N 1))
2253                           <COND (<==? <FUNCT .X> TOPLEVEL>
2254                                  <RETURN TOPLEVEL>)>
2255                           <PRINT .N>
2256                           <PRIN1 <FUNCT .X>>
2257                           <PRINC <ASCII 9>>
2258                           <PRIN1 <ARGS .X>>
2259                           <SET X <FRAME .X>>
2260                           <SET N <+ 1 .N>>>>
2261 A primitive version of the FRAMES function installed in MUDDLE.
2262 \f
2263 FREE-RUN: Returns a PROCESS to free running state
2264
2265 Object-type:  SUBR
2266
2267 Category:  PROCESS-CONTROL
2268
2269 Reference:  1STEP
2270
2271      Puts a PROCESS back into a free running state after it has been
2272 in one-step mode.  Takes a PROCESS as argument.
2273
2274 Argument:
2275
2276   Template:  #DECL ("VALUE" <OR PROCESS FALSE> PROCESS)
2277
2278 Argument 1 -- A PROCESS to return to normal running mode.
2279 Returns -- The PROCESS, or FALSE if PROCESS not in one-step mode.
2280
2281 Example:  <FREE-RUN .FOO>
2282 Now will run free when RESUMEd.
2283 \f
2284 FREE:     Free non-garbage collected STORAGE                [OBSOLETE]
2285
2286         ******* This SUBR is obsolete as of MUD55 *******
2287
2288 Object-type:  SUBR
2289
2290 Category:  DATA-HANDLING
2291
2292 Reference:  STORE
2293
2294      FREE de-allocates non-garbage collected storage (mostly used for
2295 E&S display).  Once it has been free'd it will be used by STORE again.
2296
2297 Argument:
2298
2299   Template:  #DECL ("VALUE" <PRIMTYPE STORAGE> <PRIMTYPE STORAGE>)
2300
2301 Argument 1 -- A storage: the space to be released.
2302 Returns -- The same storage -- better not hold on to it.
2303
2304 Example:  <FREE <ISTORAGE 69 0>>
2305 Free up newly created STORAGE.
2306 \f
2307 FREEZE:   Copy an object into non-moving storage
2308
2309 Object-type:  SUBR
2310
2311 Category:  DATA-HANDLING, UTILITY
2312
2313         FREEZE copies its argument into non-moving (garbage-collected)
2314 space.  It CHTYPEs the copy to its PRIMTYPE; a TUPLE is changed to a
2315 VECTOR.  FREEZEing is mostly valuable applied to the CODE of an RSUBR.
2316
2317 Argument:
2318
2319   Template:  #DECL ("VALUE" <OR VECTOR UVECTOR STRING>
2320                     <OR <PRIMTYPE VECTOR>
2321                         <PRIMTYPE TUPLE>
2322                         <PRIMTYPE UVECTOR>
2323                         <PRIMTYPE STRING>>)
2324
2325 Argument 1 -- a vector, tuple, uvector, or string to freeze
2326 Returns -- a frozen copy of arg1
2327
2328 Example:  <FREEZE <1 ,MY-RSUBR>>
2329 to debug an RSUBR
2330 \f
2331 FUNCT:    Return the function that generated a FRAME  
2332
2333 Object-type:  SUBR
2334
2335 Category:  ENVIRONMENT, UTILITY
2336
2337 Reference:  FRAME, ARGS
2338
2339      FUNCT returns the ATOM which is the name of the applicable object
2340 which caused a given FRAME to be created.  Takes a FRAME or other
2341 environment as an argument. If given a non-FRAME, it returns the
2342 topmost function name of that environment.
2343      Most commonly used as part of a more sophisticated program, such
2344 as FRAMES or FR&.
2345
2346 Argument:
2347
2348   Template:  #DECL ("VALUE" ATOM
2349                     <OR ENVIRONMENT ACTIVATION FRAME PROCESS>)
2350
2351 Argument 1 -- an environment
2352 Returns -- The ATOM which is the name of the object which caused the
2353         FRAME to be created.
2354
2355 Example:  <FUNCT <FRAME>>
2356           LISTEN
2357 If done at top level.
2358 \f
2359 FUNCTION: Create a FUNCTION
2360
2361 Object-type:  FSUBR
2362
2363 Category:  DATA-HANDLING
2364
2365 Reference:  DEFINE
2366
2367      FUNCTION creates a function.  In cases where the function is to
2368 be made the GVAL of an ATOM, it is preferable to use DEFINE.
2369      A FUNCTION consists of an optional ACTIVATION name (an ATOM),
2370 a Parameter LIST, an optional DECL, and a body consisting of at least
2371 one object.
2372
2373 Argument:
2374
2375   Template:  #DECL ("VALUE" FUNCTION "ARGS" LIST)
2376
2377 List of arguments -- if the first element of the list is an atom the
2378         activation is bound to it, the rest is the arg list, DECL, and
2379         body of the function.
2380 Returns -- A FUNCTION.
2381
2382 Example:  <FUNCTION (N) <+ 1 .N>>
2383 equivalent to #FUNCTION ((N) <+ 1 .N>)
2384 \f
2385 G=?:      Is first argument greater than or equal to the second ?
2386
2387 Object-type:  SUBR
2388
2389 Category:  PREDICATE, ARITHMETIC
2390
2391 Reference:  L?, G?
2392
2393      This routine tests if the first argument is numerically greater
2394 than or equal to the second argument, returning T if it is, #FALSE()
2395 otherwise.
2396
2397 Argument:
2398
2399   Template:  #DECL ("VALUE" <OR 'T FALSE>
2400                     <OR FIX FLOAT> <OR FIX FLOAT>)
2401
2402 Argument 1 -- A FIX or FLOAT.
2403 Argument 2 -- A FIX or FLOAT.
2404 Returns -- T if arg1 >= arg2, #FALSE() if not.
2405
2406 Example:  <G=? 2.4499998 -2>
2407           <G=? -7.2300000 -10.039999>
2408           <G=? 23 23.0>
2409 These will return T.
2410           <G=? -0.42699999E-2 0.20409999>
2411           <G=? 6 9.5709997>
2412 These will return #FALSE ().
2413 \f
2414 G?:       Is first argument greater than the second ?
2415
2416 Object-type:  SUBR
2417
2418 Category:  PREDICATE, ARITHMETIC
2419
2420 Reference:  L?, G=?
2421
2422      This routine tests if the first argument is numerically greater
2423 than the second argument, returning T if it is, #FALSE() otherwise.
2424
2425 Argument:
2426
2427   Template:  #DECL ("VALUE" <OR 'T FALSE>
2428                     <OR FIX FLOAT> <OR FIX FLOAT>)
2429
2430 Argument 1 -- A FIX or FLOAT.
2431 Argument 2 -- A FIX or FLOAT.
2432 Returns -- T if arg1 > arg2, #FALSE() if not.
2433
2434 Example:  <G? 3 2>
2435           <G? -3.4230000 -5>
2436 These will return T.
2437           <G? 0.35240000 0.34169999>
2438           <G? -146 -113>
2439           <G? 1.0 1>
2440 These will return #FALSE ().
2441 \f
2442 GASSIGNED?: Is an Atom globally assigned ?
2443
2444 Object-type:  SUBR
2445
2446 Category:  PREDICATE, IDENTIFIER
2447
2448 Reference:  ASSIGNED?, BOUND?
2449
2450      This routine is used to test if a particular Atom is globally
2451 assigned, or in other words, if it has a global value.  It does cause
2452 the activation of any read monitors on that global value.
2453      It returns T if the ATOM has a GLOBAL value, #FALSE() otherwise.
2454
2455 Argument:
2456
2457   Template:  #DECL ("VALUE" <OR 'T FALSE> ATOM)
2458
2459 Argument 1 -- An ATOM which may have a global value.
2460 Returns -- T if the ATOM has a global value, #FALSE() otherwise.
2461
2462 Example:  <SETG FOO "ANYTHING">
2463           <GASSIGNED? FOO>
2464 This will simply return the Atom T, since FOO does have a global
2465 value.
2466           <GUNASSIGN FOO>
2467           <GASSIGNED? FOO>
2468 This will simply return #FALSE (), since the Atom FOO has no global
2469 value.
2470 \f
2471 GBOUND?:  Does an atom have a global-value slot?
2472
2473 Object-type:  SUBR
2474
2475 Category:  IDENTIFIER, PREDICATE
2476
2477 Reference:  SETG, MANIFEST, GDECL, GLOC
2478
2479         GBOUND? tells whether or not an atom has a slot in the 'global
2480 vector', that is, whether it has ever been SETGed, MANIFEST, GDECLed,
2481 or GLOCed successfully.
2482
2483 Argument:
2484
2485   Template:  #DECL ("VALUE" <OR 'T FALSE> ATOM)
2486
2487 Argument 1 -- the atom to test
2488 Returns -- whether or not the atom is globally bound
2489
2490 Example:  <GBOUND? GBOUND?>
2491           T
2492 obviously
2493 \f
2494 GC-DUMP:  Dump an object so it can be reproduced exactly
2495
2496 Object-type:  SUBR
2497
2498 Category:  I/O
2499
2500 Reference:  GC-READ
2501
2502         GC-DUMP dumps an object via a channel so that GC-READ (q.v.)
2503 can reproduce it exactly, including sharing.  Any non-stack, non-pure
2504 object can be dumped, except primtypes process, locd, and asoc.
2505 If a false is given instead of a channel, GC-DUMP returns what it
2506 would have output on the channel, as a uvector.  This uvector can be
2507 stored as desired, but it must not be changed in any way to be
2508 GC-READable.
2509
2510 Argument:
2511
2512   Template:  #DECL ("VALUE" <OR ANY <UVECTOR <PRIMTYPE WORD>>>
2513                     ANY <OR CHANNEL FALSE>)
2514
2515 Argument 1 -- the object to be dumped
2516 Argument 2 -- "PRINTB/O" channel or false
2517 Returns -- arg1 if arg2 is channel, else output data
2518
2519 Example:  <GC-DUMP <PROG ((L (1 2)))
2520                          <PUTREST .L .L>>
2521                    <>>
2522 can dump circular objects
2523 \f
2524 GC-MON:   Toggle state of GC monitor
2525
2526 Object-type:  SUBR
2527
2528 Category:  ENVIRONMENT
2529
2530 Reference:  GC
2531
2532      GC-MON is used to turn on and off the typing of GIN and GOUT
2533 and other info upon entering and leaving the garbage collector.
2534      If the argument is FALSE no typing will occur, otherwise typing
2535 will occur.  The initial state of the GC-monitor is to not type.
2536
2537 Argument:
2538
2539   Template:  #DECL ("VALUE" ANY "OPTIONAL" ANY)
2540
2541 (Optional)
2542 Argument 1 -- If non-FALSE, turn on GC-monitor, else turn it off.
2543 Returns -- The previous or current state of the monitor.
2544
2545 Example:  <GC-MON T>
2546 Turn on GC-monitoring
2547 \f
2548 GC-READ:  Input an object that was previously GC-DUMPed
2549
2550 Object-type:  SUBR
2551
2552 Category:  I/O
2553
2554 Reference:  GC-DUMP
2555
2556         GC-READ returns one object from a given channel, open to a file
2557 produced by GC-DUMP (q.v.).
2558
2559 Argument:
2560
2561   Template:  #DECL ("VALUE" ANY CHANNEL "OPTIONAL" ANY)
2562
2563 Argument 1 -- a "READB" channel to read from
2564 (Optional)
2565 Argument 2 -- object to eval and return at eof
2566 Returns -- an object from the file, or arg2
2567
2568 Example:  <SET L
2569            <PROG (O
2570                   (C <OPEN "READB" "DUMPED FILE">))
2571                  <STACKFORM ,LIST
2572                   .O
2573                   <SET O
2574                        <GC-READ .READB-CHNL <>>>>>>
2575 get all GC-DUMPed objects from a file
2576 \f
2577 GC:       Cause a Garbage Collection to occur
2578
2579 Object-type:  SUBR
2580
2581 Category:  ENVIRONMENT
2582
2583 Reference:  GC-MON, BLOAT
2584
2585      GC always causes a garbage collection and returns the amount
2586 of storage reclaimed.  Its first optional argument specifies the
2587 minimum amount of free space tolerable in future gc's.  Its second
2588 argument tells whether this gc should be exhaustive.  Its third argument
2589 changes the parameter telling how many mark-sweep gcs to do between
2590 "real" ones; this is initially 0, meaning never mark-sweep.
2591
2592 Argument:
2593
2594   Template:  #DECL ("VALUE" FIX "OPTIONAL" FIX <OR FALSE ANY> FIX)
2595
2596 (Optional)
2597 Argument 1 -- FIX specifying amount of free space to get.
2598 Argument 2 -- whether gc should be exhaustive
2599 Argument 3 -- how many mark-sweep GCs to do between "real" ones.
2600 Returns -- A FIX giving the amount free space reclaimed.
2601
2602 Example:  <GC 30000 <>>
2603 GC and change a GC parameter
2604 \f
2605 GDECL:    Make a declaration for a global value
2606
2607 Object-type:  FSUBR
2608
2609 Category:  DATA-HANDLING
2610
2611 Reference:  GET-DECL, PUT-DECL, MANIFEST
2612
2613      GDECL is used to make a DECL for a global value or values, in
2614 much the same way as the #DECL () construct is used for local values.
2615 It takes the standard DECL syntax argument (ie, CHTYPEing REST of the
2616 GDECL form to DECL would make it look like a local DECL).
2617      ATOMs that have been GDECLed will give ERRORs on an attempt to
2618 SETG them to something that conflicts with their DECL, unless, of
2619 course, DECL-checking is disabled.
2620
2621 Argument:
2622
2623   Template:  #DECL ("VALUE" ANY
2624                     "ARGS" <LIST [REST
2625                                   <LIST [REST ATOM]>
2626                                   <OR ATOM FORM>]>)
2627
2628 List of arguments -- Pairs consisting of a LIST of ATOMs and a
2629         DECL body.
2630 Returns -- T
2631
2632 Example:  <GDECL (FOO)
2633                  FIX
2634                  (BAR)
2635                  <LIST [REST LIST]>>
2636 Just like local DECLs.
2637 \f
2638 GET-DECL: Get the DECL of an ATOM
2639
2640 Object-type:  SUBR
2641
2642 Category:  DATA-HANDLING
2643
2644 Reference:  PUT-DECL
2645
2646      GET-DECL returns the current DECL of an ATOM's GVAL or LVAL.
2647 It takes a single argument, a locative to the value.  It returns
2648 either the DECL, the ATOM MANIFEST (if the ATOM is manifest), or
2649 FALSE, if the ATOM has no DECL.
2650      The use of locatives allows the same SUBR to work for both local
2651 and global values.
2652
2653      If given an OFFSET, returns the DECL part of the OFFSET.
2654
2655 Argument:
2656
2657   Template:  #DECL ("VALUE" <OR ATOM FORM FALSE> <OR LOCD OFFSET>)
2658
2659 Argument 1 -- A locative to the global or local value slot of an
2660         ATOM, or an OFFSET.
2661 Returns -- The DECL of that value, or MANIFEST, or FALSE.
2662
2663 Example:  <SET FOO (1 2 3)>
2664           <SET BAR (4 5 6)>
2665           <GDECL (FOO BAR) LIST>
2666           <GET-DECL <GLOC FOO>>
2667           LIST
2668
2669           <GET-DECL <OFFSET 1 '<CHANNEL FIX>>>
2670           <CHANNEL FIX>
2671
2672 See also PUT-DECL, for changing declarations.
2673 \f
2674 GET:      Get an element of a structure or the value of an association
2675
2676 Object-type:  SUBR
2677
2678 Category:  DATA-HANDLING, ASSOCIATION
2679
2680 Reference:  PUT, GETPROP
2681
2682      GET returns a given property associated with an item, or if
2683 second arg is a fix and the object is structured, returns that element
2684 of the structured object.
2685      Thus, GET is like GETPROP if the first argument is not a structure,
2686 and like NTH if it is.
2687      If GET is being used like GETPROP, an optional third argument is
2688 allowed, which is what to return if there is no association between
2689 the given item and indicator.
2690
2691 Argument:
2692
2693   Template:  #DECL ("VALUE" ANY ANY ANY "OPTIONAL" ANY)
2694
2695 Argument 1 -- The object with the association or structure.
2696 Argument 2 -- The indicator under which the association is stored or
2697         the FIX offset within a structure.
2698 (Optional)
2699 Argument 3 -- The default to be evaled and returned if no assoc, else
2700          FALSE is the result.
2701 Returns -- The element of the structure, value of the association, or
2702         the optional third argument if given, or FALSE.
2703
2704 Example:  <PROG ((A (1 2 3 4)))
2705                 <PUT .A 2 5>
2706                 <PUTPROP .A 3 6>
2707                 <PUT .A X "STRING">
2708                 (.A
2709                  <GET .A 2>
2710                  <GETPROP .A 3>
2711                  <GET .A X>)>
2712 Notice the difference between the PROP and non-prop subrs
2713 \f
2714 GETBITS:  Get part of a word
2715
2716 Object-type:  SUBR
2717
2718 Category:  BIT-TWIDDLING
2719
2720 Reference:  BITS, PUTBITS
2721
2722      GETBITS takes a PRIMTYPE WORD (or a STORAGE, for which its
2723 address is used) and a BITS, and returns a word generated by picking
2724 up the bits described by the BITS.  For example, a BITS of <BITS 7>
2725 describes the rightmost 7 bits of a word.  Therefore, a GETBITS using
2726 it will return the rightmost 7 bits.
2727         It is functionally equivalent to the PDP-10 Load Byte (LDB)
2728 instruction.
2729
2730 Argument:
2731
2732   Template:  #DECL ("VALUE" WORD <PRIMTYPE <OR WORD STORAGE>> BITS)
2733
2734 Argument 1 -- An object of type WORD.
2735 Argument 2 -- A BITS, as returned by BITS.
2736 Returns -- A WORD containing the bits described by Argument 2.
2737
2738 Example:  <GETBITS -1 <BITS 3>>
2739           #WORD *000000000007*
2740 Non-WORDs need not be CHTYPEd.
2741 \f
2742 GETL:     Get a locative to a structure or the value of an association
2743
2744 Object-type:  SUBR
2745
2746 Category:  DATA-HANDLING, ASSOCIATION
2747
2748 Reference:  PUT, GETPROP, GETPL
2749
2750      GETL returns a locative to a given association, or if second arg
2751 is a fix and the object is structured, returns a locative to that
2752 element of the structured object.
2753      Thus, GETL is like GETPL if the first argument is not a structure,
2754 and like AT if it is.
2755      If GETL is being used like GETPL, an optional third argument is
2756 allowed, which is what to return if there is no association between
2757 the given item and indicator.
2758
2759 Argument:
2760
2761   Template:  #DECL ("VALUE" <OR LOCATIVE ANY> ANY ANY
2762                     "OPTIONAL" ANY)
2763
2764 Argument 1 -- The item part of the association or a structure.
2765 Argument 2 -- The indicator under which the association is stored or
2766         the FIX offset within a structure.
2767 (Optional)
2768 Argument 3 -- The default to be evaled and returned if no assoc, else
2769          FALSE is the result.
2770 Returns -- A locative to the association or element of a structure, or
2771         if acting like GETPL and there is no association, eval of the
2772         optional third argument if given, or FALSE.
2773
2774 Example:  <PROG ((A (1 2 3 4)))
2775                 <PUT .A 2 5>
2776                 <PUTPROP .A 3 6>
2777                 <PUT .A X "STRING">
2778                 (.A
2779                  <GETL .A 2>
2780                  <GETPL .A 3>
2781                  <GETL .A X>)>
2782 Notice the difference between the PROP and non-prop subrs
2783 \f
2784 GETPL:    Get an a locative to the value of an association
2785
2786 Object-type:  SUBR
2787
2788 Category:  ASSOCIATION
2789
2790 Reference:  PUT, GETPROP, GETL
2791
2792      GETPL returns a locative to the value part of an association
2793 with given item (arg1) and indicator (arg2).  It also takes a third
2794 argument (optional) which will be evaled if the association does not
2795 exist (default is FALSE).
2796      Note that GETL is identical to GETPL if its first argument is not
2797 structured and its second is not a FIX.
2798
2799 Argument:
2800
2801   Template:  #DECL ("VALUE" <OR LOCAS ANY> ANY ANY "OPTIONAL" ANY)
2802
2803 Argument 1 -- The object with the association.
2804 Argument 2 -- The indicator under which the association is stored.
2805 (Optional)
2806 Argument 3 -- The default to be evaled and returned if no assoc, else
2807          FALSE is the result.
2808 Returns -- A locative (type LOCAS) to the association if it exists, or
2809         eval of the optional third argument if given, or FALSE.
2810
2811 Example:  <PROG ((A (1 2 3 4)))
2812                 <PUT .A 2 5>
2813                 <PUTPROP .A 3 6>
2814                 <PUT .A X "STRING">
2815                 (.A
2816                  <GETL .A 2>
2817                  <GETPL .A 3>
2818                  <GETL .A X>)>
2819 Notice the difference between the PROP and non-prop subrs
2820 \f
2821 GETPROP:  Get the value of an association
2822
2823 Object-type:  SUBR
2824
2825 Category:  DATA-HANDLING, ASSOCIATION
2826
2827 Reference:  PUT, PUTPROP, GETPL, GETL
2828
2829      GETPROP returns a given property associated with an item.  It
2830 takes two required arguments, the item and the indicator, and a third
2831 argument which is optional, and which will be evaled and returned if
2832 the item-indicator pair has no association on it (default a FALSE).
2833      GETPROP is thus one end of a triad of SUBRs, GETPROP, GET and NTH,
2834 which together make up a full association/subelement mechanism.  This
2835 is paralleled by PUT and PUTPROP, and GETPL, GETL and AT.
2836
2837 Argument:
2838
2839   Template:  #DECL ("VALUE" ANY ANY ANY "OPTIONAL" ANY)
2840
2841 Argument 1 -- The item part of an item-indicator pair.
2842 Argument 2 -- The indicator under which the association is stored.
2843 (Optional)
2844 Argument 3 -- The default to be evaled and returned if no assoc, else
2845          FALSE is the result.
2846 Returns -- The element of the structure, value of the association, or
2847         the optional third argument if given, or FALSE.
2848
2849 Example:  <PROG ((A (1 2 3 4)))
2850                 <PUT .A 2 5>
2851                 <PUTPROP .A 3 6>
2852                 <PUT .A X "STRING">
2853                 (.A
2854                  <GET .A 2>
2855                  <GETPROP .A 3>
2856                  <GET .A X>)>
2857 Notice the difference between the PROP and non-prop subrs
2858 \f
2859 GLOC:     Get a locative to the GVAL of an ATOM
2860
2861 Object-type:  SUBR
2862
2863 Category:  DATA-HANDLING
2864
2865 Reference:  LLOC
2866
2867      Returns a locative, type LOCD, to the GVAL of the ATOM passed
2868 as its argument.  If the ATOM has no GVAL slot, ERROR, unless second
2869 arg is given and true.
2870
2871 Argument:
2872
2873   Template:  #DECL ("VALUE" LOCD ATOM "OPTIONAL" <OR FALSE ANY>)
2874
2875 Argument 1 -- An ATOM with a GVAL.
2876 (Optional)
2877 Argument 2 -- whether not to give a no-slot error or not
2878 Returns -- A locative (LOCD) to the GVAL of the ATOM.
2879
2880 Example:  <AND <GASSIGNED? FOO> <GLOC FOO>>
2881 Guard against ATOMs with no GVALs.
2882 \f
2883 GO:       Go elsewhere in a PROG/REPEAT
2884
2885 Object-type:  SUBR
2886
2887 Category:  PROGRAM-CONTROL
2888
2889 Reference:  TAG, PROG, REPEAT
2890
2891         GO transfers control to a given top-level object within a PROG
2892 or REPEAT.  The place to go is specified by an atom label or a tag.
2893 GO is very seldom tasteful: use nested REPEAT or MAPF/R instead.
2894
2895 Argument:
2896
2897   Template:  #DECL ("VALUE" ANY <OR ATOM TAG>)
2898
2899 Argument 1 -- where to go to
2900 Returns -- RESUME arg, if tag lay in another process
2901
2902 Example:  <PROG (&)
2903                 <&>
2904                 AWAY
2905                 <FOO>
2906                 <&>
2907                 <GO AWAY>
2908                 &..>
2909 exactly what GO should do
2910 \f
2911 GROW:     Enlarge a VECTOR or UVECTOR
2912
2913 Object-type:  SUBR
2914
2915 Category:  DATA-HANDLING
2916
2917 Reference:  GC
2918
2919      GROW extends the bounds of a vector or uvector.  Be aware that
2920 growing causes a garbage collection and is therefore an expensive
2921 operation.  That is the reason it is only done in increments of 32 or
2922 64.
2923
2924 Argument:
2925
2926   Template:  #DECL ("VALUE" <PRIMTYPE <OR VECTOR UVECTOR>>
2927                     <PRIMTYPE <OR VECTOR UVECTOR>> FIX FIX)
2928
2929 Argument 1 -- The object to grow.
2930 Argument 2 -- Number to be added to the end rounded up to a multiple
2931         of 32 for VECTORs, 64 for UVECTORs.
2932 Argument 3 -- Number to be added to beginning rounded up to a multiple
2933         of 32 for VECTORs, 64 for UVECTORs.
2934 Returns -- The newly enlarged VECTOR or UVECTOR.
2935
2936 Example:  <GROW ![1 2 3!] 1 1>
2937 will grow by 32 on each end.
2938 \f
2939 GUNASSIGN: Removes the Global value of an ATOM
2940
2941 Object-type:  SUBR
2942
2943 Category:  IDENTIFIER
2944
2945 Reference:  GVAL, GASSIGNED?
2946
2947      GUNASSIGN removes the global value of an ATOM.  After an ATOM
2948 has been GUNASSIGNED, GVAL of it will cause and error, and GASSIGNED?
2949 of it will return FALSE.
2950
2951 Argument:
2952
2953   Template:  #DECL ("VALUE" ATOM ATOM)
2954
2955 Argument 1 -- The ATOM to flush the GVAL of.
2956 Returns -- The ATOM you just GUNASSIGNed.
2957
2958 Example:  <GUNASSIGN GUNASSIGN>
2959           GUNASSIGN
2960 Something you only do once.
2961 \f
2962 GVAL:     Return the Global value of an ATOM
2963
2964 Object-type:  SUBR
2965
2966 Category:  IDENTIFIER
2967
2968 Reference:  GASSIGNED?, GUNASSIGN
2969
2970      Returns the Global value of an ATOM, if any.  If the ATOM has
2971 no Global value, ERROR.
2972      The expressions ,<an atom> and <GVAL <an atom>> are identical.
2973
2974 Argument:
2975
2976   Template:  #DECL ("VALUE" ANY ATOM)
2977
2978 Argument 1 -- An ATOM.
2979 Returns -- Its GVAL, if it has one.
2980
2981 Example:  <==? ,FOO .FOO>
2982
2983 GVAL and LVAL are independent, but watch out using both -- the last
2984 referenced is kept in the ATOM's value slot, so switching back and
2985 forth can be expensive! 
2986 \f
2987 HANDLER:  Attach an interrupt handler to an IHEADER
2988
2989 Object-type:  SUBR
2990
2991 Category:  INTERRUPT
2992
2993 Reference:  EVENT, ENABLE, DISABLE
2994
2995      HANDLER attaches an interrupt handler to an IHEADER.  It may
2996 build and attach a new handler or reattach a previously OFFed handler.
2997      The first argument is always the IHEADER.  The second argument
2998 is either the previously OFFd handler or an applicable object.
2999 The last argument is optional and may be a
3000 process in which the handler is to run.  If no process is supplied,
3001 the interrupt will run in whatever process is currently running.
3002 Note:  new handlers are always added to the beginning of the list of
3003 handlers.
3004
3005 Argument:
3006
3007   Template:  #DECL ("VALUE" HANDLER IHEADER <OR HANDLER
3008                                                 APPLICABLE>
3009                     "OPTIONAL" PROCESS)
3010
3011 Argument 1 -- An IHEADER, such as is returned by EVENT.
3012 Argument 2 -- An APPLICABLE object to handle the interrupt, or a 
3013         previously OFFed HANDLER.
3014 (Optional)
3015 Argument 3 -- A PROCESS in which to run the interrupt.
3016 Returns -- A HANDLER, which has been added to the beginning of the
3017         list of HANDLERs for that interrupt.
3018
3019 Example:  <HANDLER <SET TEM <EVENT "CHAR" 10 .INCHAN>>
3020                    ,QUITTER>
3021 Setup a character interrupt with one handler.
3022 \f
3023 HANG:     Hang interruptably forever
3024
3025 Object-type:  SUBR
3026
3027 Category:  ENVIRONMENT, INTERRUPT
3028
3029 Reference:  SLEEP
3030
3031      HANG causes the MUDDLE to hang interruptably forever.  It is
3032 useful if there is an activation available to return to beyond the
3033 HANG.  Alternatively, it takes an optional argument which is EVALed
3034 each time an interrupt DISMISSes back to the HANG.  If the argument
3035 EVALs to non-FALSE, the HANG terminates, returning the result of the
3036 EVAL.
3037
3038 Argument:
3039
3040   Template:  #DECL ("VALUE" ANY "OPTIONAL" ANY)
3041
3042 (Optional)
3043 Argument 1 -- Something to EVAL each time the HANG is dismissed to.
3044 Returns -- The result of EVALing the argument, or if it is not given,
3045         never returns  (May be non-locally returned beyond, of course).
3046
3047 Example:  <HANG .FOO>
3048 Hang until someone (at interrupt level) sets FOO to a non-FALSE.
3049 \f
3050 IBYTES:   Generate a BYTES by repeated Evaluation
3051
3052 Object-type:  SUBR
3053
3054 Category:  DATA-HANDLING
3055
3056 Reference:  BYTES  
3057
3058      IBYTES returns a byte-string of given byte-size and length whose
3059 elements are generated by repeated evaluation of the third argument.
3060 Note that the third argument must return a FIX each time it is EVALed.
3061
3062 Argument:
3063
3064   Template:  #DECL ("VALUE" BYTES FIX FIX "OPTIONAL" ANY)
3065
3066 Argument 1 -- FIX, size of bytes
3067 Argument 2 -- FIX, number of elements.
3068 (Optional)
3069 Argument 3 -- ANY, expression which when evaled, gives each element,
3070         default is zeros.
3071 Returns -- Newly baked BYTES.
3072
3073 Example:  <IBYTES 3 9 '<COND (<ASSIGNED? X> <SET X <+ 1 .X>>) (<SET X 0>)>>
3074           #3 {0 1 2 3 4 5 6 7 0}
3075 \f
3076 IFORM:    Generate a FORM by repeated Evaluation
3077
3078 Object-type:  SUBR
3079
3080 Category:  DATA-HANDLING
3081
3082 Reference:  FORM
3083
3084      IFORM returns a form of given length whose elements are generated
3085 by repeated evaluation of the second argument.
3086
3087 Argument:
3088
3089   Template:  #DECL ("VALUE" FORM FIX "OPTIONAL" ANY)
3090
3091 Argument 1 -- FIX, number of elements to generate.
3092 (Optional)
3093 Argument 2 -- ANY, expression which when evaled, gives each element
3094         default is #LOSE *0*'s.
3095 Returns -- The newly hatched FORM.
3096
3097 Example:  <SET ROOTL <LENGTH <ROOT>>>
3098           <IFORM 5 '<1 <NTH <ROOT> <MOD <RANDOM> .ROOTL>>>>
3099
3100 Makes a FORM by picking the first elements of 5 randomly selected
3101 buckets in the ROOT OBLIST.
3102 \f
3103 ILIST:    Generate a LIST by repeated Evaluation
3104
3105 Object-type:  SUBR
3106
3107 Category:  DATA-HANDLING
3108
3109 Reference:  LIST
3110
3111      ILIST returns a list of given length whose elements are generated
3112 by repeated evaluation of the second argument.
3113
3114 Argument:
3115
3116   Template:  #DECL ("VALUE" LIST FIX "OPTIONAL" ANY)
3117
3118 Argument 1 -- FIX, number of elements
3119 (Optional)
3120 Argument 2 -- ANY, expression which when evaled, gives each element
3121         default is #LOSE *0*'s
3122 Returns -- The newly created LIST.
3123
3124 Example:  <ILIST 5 0>
3125 Create a LIST containing five 0s.
3126 \f
3127 IMAGE:    Output a naked character
3128
3129 Object-type:  SUBR
3130
3131 Category:  I/O
3132
3133 Reference:  PRINC
3134
3135         IMAGE outputs precisely the character whose ASCII value is
3136 given as an arg.  It does not add up-arrow, line-feed, etc.
3137
3138 Argument:
3139
3140   Template:  #DECL ("VALUE" FIX FIX "OPTIONAL" CHANNEL)
3141
3142 Argument 1 -- ASCII code for character to send naked
3143 (Optional)
3144 Argument 2 -- the channel to send it on, default .OUTCHAN
3145 Returns -- arg1
3146
3147 Example:  <IMAGE 1>
3148           1
3149           <IMAGE 2>
3150           2
3151 draws an I-beam on an Imlac
3152 \f
3153 IN:       Get the object a locative points to
3154
3155 Object-type:  SUBR
3156
3157 Category:  DATA-HANDLING
3158
3159 Reference:  AT, LLOC, GLOC, LEGAL?
3160
3161      Returns the object a locative points to.  The only way you can
3162 get an error using IN is to pass it a locative to an LVAL that has
3163 become unbound.  Using LEGAL? will save you much grief.
3164
3165 Argument:
3166
3167   Template:  #DECL ("VALUE" ANY LOCATIVE)
3168
3169 Argument 1 -- A locative.
3170 Returns -- The object the locative points to.
3171
3172 Example:  <SET FOO 69>
3173           <IN <LLOC FOO>>
3174           69
3175 Like LVAL except independent of rebindings of FOO.
3176 \f
3177 INDEX: Return the index part of an OFFSET
3178
3179 Object-type:  SUBR
3180
3181 Category:  STRUCTURES
3182
3183 Reference:  OFFSET, NTH, GET-DECL, PUT-DECL
3184
3185      Given an OFFSET, returns the index part.
3186
3187 Argument:
3188
3189   Template:  #DECL ("VALUE" FIX OFFSET)
3190
3191 Argument 1 -- An OFFSET
3192 Returns -- The index field of the OFFSET.
3193
3194 Example:  <SET CHNUM <OFFSET 1 '<CHANNEL FIX>>>
3195           %<OFFSET 1 '<CHANNEL FIX>>
3196           <INDEX .CHNUM>
3197           1
3198 Use GET-DECL to get the DECL part of the OFFSET.
3199 \f
3200 INDICATOR: Return the indicator part of an Association triad
3201
3202 Object-type:  SUBR
3203
3204 Category:  ASSOCIATION
3205
3206 Reference:  ASSOCIATIONS, NEXT, ITEM, AVALUE, 
3207             GETPROP, GET
3208
3209      Given an ASOC, as returned by ASSOCIATIONS or NEXT, returns the
3210 indicator part of the ASOC triad.
3211      See also ITEM and AVALUE, which return the Item and Value parts
3212 of the triad.
3213
3214 Argument:
3215
3216   Template:  #DECL ("VALUE" ANY ASOC)
3217
3218 Argument 1 -- An ASOC whose indicator field to get.
3219 Returns -- The indicator field of the ASOC.
3220
3221 Example:  <PUTPROP FOO BAR BLECH>
3222           <ITEM <ASSOCIATIONS>>
3223           FOO
3224           <INDICATOR <ASSOCIATIONS>>
3225           BAR
3226           <AVALUE <ASSOCIATIONS>>
3227           BLECH
3228 ASSOCIATIONS gets newest ASOC.
3229 \f
3230 INSERT:   Create an ATOM and put it on an OBLIST
3231
3232 Object-type:  SUBR
3233
3234 Category:  IDENTIFIER
3235
3236 Reference:  ATOM, LOOKUP
3237
3238      INSERT takes as argument a STRING, which will be the PNAME of
3239 a new ATOM on the OBLIST given as the second argument.  The ATOM is
3240 returned.
3241      In the special case where the ATOM is not already on an OBLIST,
3242 INSERT will also take an ATOM as argument.  In conjunction with REMOVE
3243 this feature may be used to move an ATOM from one OBLIST to another.
3244      Note that if the ATOM with the PNAME given already exists on that
3245 OBLIST, ERROR.  See the example for the standard foolproof way to
3246 INSERT.
3247
3248 Argument:
3249
3250   Template:  #DECL ("VALUE" ATOM <OR ATOM STRING> OBLIST)
3251
3252 Argument 1 -- A STRING, which is the PNAME of a new ATOM to be
3253         created, or an ATOM on no OBLIST.
3254 Argument 2 -- An OBLIST into which to insert the new ATOM.
3255 Returns -- The newly minted ATOM.
3256
3257 Example:  <INSERT "GVAL" <ROOT>>
3258 This will fail, as the ATOM is already there.
3259           <OR <LOOKUP "GVAL" <ROOT>> <INSERT "GVAL" <ROOT>>>
3260 Guaranteed to win.
3261 \f
3262 INT-LEVEL: Read and set the current interrupt level
3263
3264 Object-type:  SUBR
3265
3266 Category:  INTERRUPT
3267
3268      INT-LEVEL is used to read and set the current interrupt level.
3269 If it is called with no arguments, it simply returns the current level
3270 otherwise it causes its fixed point argument to be the current
3271 interrupt level and returns the previous one.
3272      Note that 0 is the 'normal' int-level, and during handling of an
3273 interrupt, the int-level is set to the priority assigned to the int-
3274 errupt that is being handled.
3275
3276 Argument:
3277
3278   Template:  #DECL ("VALUE" FIX "OPTIONAL" FIX)
3279
3280 (Optional)
3281 Argument 1 -- A FIX, which will be the new interrupt level.  If not
3282         given, simply returns the current level.
3283 Returns -- A FIX, the interrupt level at the time of the call (ie:
3284         if changed, the old one).
3285
3286 Example:  <INT-LEVEL <MIN>>
3287 Cause all interrupts to be deferred.
3288 \f
3289 INTERRUPT: Generate an artificial interrupt
3290
3291 Object-type:  SUBR
3292
3293 Category:  INTERRUPT
3294
3295       INTERRUPT causes a software interrupt to happen.  If the
3296 interrupt has an IHEADER associated with it, either run the handlers
3297 or queue them depending on the INT-LEVEL.  If the IHEADER exists
3298 return T, otherwise return #FALSE ().  The first argument to INTERRUPT
3299 is either an IHEADER, atom or string specifying the interrupt to do.
3300      The rest of the arguments are applied to the functions associated
3301 with the various handlers.
3302      INTERRUPT is used either to cause a 'software' interrupt (one
3303 identified by a name not normally in the INTERRUPTS OBLIST) or to test
3304 a 'real' interrupt handler.
3305
3306 Argument:
3307
3308   Template:  #DECL ("VALUE" <OR 'T FALSE> <OR IHEADER STRING ATOM> "TUPLE"
3309                     <TUPLE [REST ANY]>)
3310
3311 Argument 1 -- An identifier of the interrupt to be generated, either
3312         a STRING, ATOM, or IHEADER.
3313 Tuple of arguments -- The appropriate arguments for the handler for
3314         this interrupt.
3315 Returns -- T if an IHEADER exists for this interrupt, FALSE otherwise.
3316
3317 Example:  <INTERRUPT "FOO" 1 2 3>
3318 Causes a FOO interrupt if an IHEADER exists.
3319 \f
3320 INTERRUPTS: Return the INTERRUPTS OBLIST
3321
3322 Object-type:  SUBR
3323
3324 Category:  INTERRUPT
3325
3326      INTERRUPTS returns the INTERRUPTS oblist.  This oblist contains
3327 atoms that are dangerous to play with.  These include atoms associated
3328 with interrupts and the special atoms LPROG , LERR and LMAP .
3329
3330 Argument:
3331
3332   Template:  #DECL ("VALUE" OBLIST)
3333
3334 Example:  <INTERRUPTS>
3335 Only possible invocation.
3336 \f
3337 IPC-HANDLER: Default IPC message handler
3338
3339 Object-type:  SUBR
3340
3341 Category:  INTERNAL, INTERRUPT, SYSTEM
3342
3343 Reference:  IPC-ON, IPC-OFF, SEND, SEND-WAIT
3344
3345      IPC-HANDLER is the default IPC message handler.  It prints out
3346 the message, who it is from, the type if non-zero, and who it is to,
3347 if not uname, jname.  If the type is 1, and the message is a STRING,
3348 it is parsed and evaluated as well as being printed out.  See the
3349 FUNCTION INQUIRE for an application of this feature.
3350      IPC conditions are signalled with arguments as specified in the
3351 'Template' field below.
3352
3353 Argument:
3354
3355   Template:  #DECL ("VALUE" ANY <OR STRING UVECTOR STORAGE> FIX STRING STRING
3356                     "OPTIONAL" STRING STRING)
3357
3358 (Arguments to any IPC condition handler)
3359 Argument 1 -- The message received.  This may be a STRING, a UVECTOR,
3360         of UTYPE primtype FIX, or a STORAGE.
3361 Argument 2 -- The type of the message, a FIX.  The interpretation of
3362         this is entirely up to the handler.
3363 Arguments 3 & 4 -- STRINGs specifying whom the message is from.
3364 (Optional)
3365 Arguments 5 & 6 -- STRINGs specifying whom the message is to, if other
3366         than UNAME-JNAME.
3367 Returns -- T
3368
3369 Example:  <IPC-HANDLER "HELLO, HOW ARE YOU." 0 "CLR" "MUDDLE">
3370
3371 Just prints this out.  Actually you would never see or invoke this
3372 form, since only happens at interrupt level.
3373 \f
3374 IPC-OFF:  Stop listening for IPC messages
3375
3376 Object-type:  SUBR
3377
3378 Category:  SYSTEM
3379
3380 Reference:  IPC-ON, IPC-HANDLER, SEND, SEND-WAIT
3381
3382      IPC-OFF causes the MUDDLE to stop listening for messages on the
3383 IPC.  The opposite is IPC-ON, which causes the MUDDLE to listen.
3384
3385 Argument:
3386
3387   Template:  #DECL ("VALUE" ANY)
3388
3389 Returns -- T
3390
3391 Example:  <IPC-OFF>
3392 In virgin MUDDLE, disable default IPC handler, IPC-HANDLER.
3393 \f
3394 IPC-ON:   Listen for IPC messages sent to a given pair
3395
3396 Object-type:  SUBR
3397
3398 Category:  SYSTEM
3399
3400 Reference:  IPC-OFF, SEND, SEND-WAIT, IPC-HANDLER
3401
3402      IPC-ON takes two STRINGs as arguments, and listens for IPC
3403 messages addressed to that pair.  If they are received, an IPC
3404 condition is signalled.  There is a default handler for this condition
3405 called IPC-HANDLER.  See its abstract for more details.
3406
3407 Argument:
3408
3409   Template:  #DECL ("VALUE" ANY "OPTIONAL" STRING STRING)
3410
3411 (Optional)
3412 Arguments 1 & 2 -- A pair of names to listen on, default UNAME JNAME
3413         of the MUDDLE.
3414 Returns -- ANY
3415
3416 Example:  <IPC-ON>
3417 Usually jobs listen on their uname-jname to avoid confusion.
3418 \f
3419 ISTORAGE: Generate a STORAGE by repeated Evaluation
3420
3421 Object-type:  SUBR
3422
3423 Category:  DATA-HANDLING
3424
3425 Reference:  STORE
3426
3427      ISTORAGE  Return a non-g.c. storage area of given length with
3428 elements generated by repeated evaluation of the second argument.
3429      Storage is normally used for the E&S, since it does not move
3430 during garbage collection.
3431      Note that the repeatedly EVALed argument must return something
3432 suitable to be in a STORAGE (ie, no STRINGs) and also the results must
3433 be of uniform type.
3434
3435 Argument:
3436
3437   Template:  #DECL ("VALUE" STORAGE FIX "OPTIONAL" ANY)
3438
3439 Argument 1 -- FIX, number of elements.
3440 (Optional)
3441 Argument 2 -- ANY, expression which when evaled, gives each element
3442         default is #LOSE *0*'s.
3443 Returns -- Newly minted STORAGE.
3444
3445 Example:  <ISTORAGE 10 '<RANDOM>>
3446 Create a STORAGE with random contents.
3447 \f
3448 ISTRING:  Generate a STRING by repeated Evaluation
3449
3450 Object-type:  SUBR
3451
3452 Category:  DATA-HANDLING
3453
3454 Reference:  STRING
3455
3456      ISTRING returns a string of given length whose elements are
3457 generated by repeated evaluation of the second argument.  Note that
3458 the second argument must return a CHARACTER each time it is EVALed.
3459
3460 Argument:
3461
3462   Template:  #DECL ("VALUE" STRING FIX "OPTIONAL" ANY)
3463
3464 Argument 1 -- FIX, number of elements.
3465 (Optional)
3466 Argument 2 -- ANY, expression which when evaled, gives each element,
3467         default is ^@'s.
3468 Returns -- Newly baked STRING.
3469
3470 Example:  <ISTRING 20 '<CHTYPE <MOD <RANDOM> 128> CHARACTER>>
3471 Note the CHTYPEing to type CHARACTER.
3472 \f
3473 ITEM:     Return the item part of an Association triad
3474
3475 Object-type:  SUBR
3476
3477 Category:  ASSOCIATION
3478
3479 Reference:  ASSOCIATIONS, NEXT, AVALUE, INDICATOR, 
3480             GETPROP, GET
3481
3482      Given an ASOC, as returned by ASSOCIATIONS or NEXT, returns the
3483 item part of the ASOC triad.  See also INDICATOR and AVALUE, which get
3484 the Indicator and Value parts of the triad.
3485
3486 Argument:
3487
3488   Template:  #DECL ("VALUE" ANY ASOC)
3489
3490 Argument 1 -- An ASOC whose item field to get.
3491 Returns -- The item field of the ASOC.
3492
3493 Example:  <PUTPROP FOO BAR BLECH>
3494           <ITEM <ASSOCIATIONS>>
3495           FOO
3496           <INDICATOR <ASSOCIATIONS>>
3497           BAR
3498           <AVALUE <ASSOCIATIONS>>
3499           BLECH
3500 ASSOCIATONS gets newest ASOC.
3501 \f
3502 ITUPLE:   Generate a TUPLE by repeated Evaluation
3503
3504 Object-type:  SUBR
3505
3506 Category:  DATA-HANDLING
3507
3508 Reference:  TUPLE
3509
3510      ITUPLE returns a TUPLE (vector on the stack) of given length whose
3511 elements are generated by repeated evaluation of the second argument.
3512 ITUPLE is exactly like IVECTOR, except for the restriction that it may
3513 only be applied at top-level inside the parameter list of a FUNCTION,
3514 in AUX or OPTIONAL atom-value pairs, or at top level inside the atom-
3515 value pairs of PROGs or REPEATs.
3516      Note also that ITUPLE does not compile very well.
3517
3518 Argument:
3519
3520   Template:  #DECL ("VALUE" TUPLE FIX "OPTIONAL" ANY)
3521
3522 Argument 1 -- FIX, number of elements.
3523 (Optional)
3524 Argument 2 -- ANY, expression which when evaled, gives each element
3525         default is #LOSE *0*'s
3526 Returns -- Newly stacked TUPLE.
3527
3528 Example:  <PROG ((A <ITUPLE 4 0>))
3529                 <PUT .A 2 3>
3530                 (!.A)>
3531 This is a valid usage of ITUPLE.
3532
3533           <DEFINE FOO (A
3534                                 "AUX" (X
3535                                        <REST <ITUPLE !.A>>))
3536                   .X>
3537
3538 This is not a valid usage of ITUPLE, since the application is not at
3539 top level of the atom-value pair.
3540 \f
3541 IUVECTOR: Generate a UVECTOR by repeated Evaluation
3542
3543 Object-type:  SUBR
3544
3545 Category:  DATA-HANDLING
3546
3547 Reference:  UVECTOR
3548
3549      IUVECTOR returns a uniform vector of given length whose elements
3550 are generated by repeated evaluation of the second argument.
3551      Note that the second argument must return objects all the same
3552 type and appropriate to be part of a UVECTOR (ie: no STRINGs).
3553
3554 Argument:
3555
3556   Template:  #DECL ("VALUE" UVECTOR FIX "OPTIONAL" ANY)
3557
3558 Argument 1 -- FIX, number of elements.
3559 (Optional)
3560 Argument 2 -- ANY, expression which when evaled, gives each element
3561         (must all be of same type) default is #LOSE *0*'s.
3562 Returns -- Newly created UVECTOR.
3563
3564 Example:  <PROG ((A 2))
3565                 <IUVECTOR 5
3566                           '<SET A
3567                                 <* .A .A>>>>
3568 Powers of 2.
3569 \f
3570 IVECTOR:  Generate a VECTOR by repeated Evaluation
3571
3572 Object-type:  SUBR
3573
3574 Category:  DATA-HANDLING
3575
3576 Reference:  VECTOR
3577
3578      IVECTOR returns a vector of given length whose elements are
3579 generated by repeated evaluation of the second argument.
3580
3581 Argument:
3582
3583   Template:  #DECL ("VALUE" VECTOR FIX "OPTIONAL" ANY)
3584
3585 Argument 1 -- FIX, number of elements.
3586 (Optional)
3587 Argument 2 -- ANY, expression which when evaled, gives each element
3588         default is #LOSE *0*'s.
3589 Returns -- Newly created VECTOR.
3590
3591 Example:  <IVECTOR 5 "ha">
3592           ["ha" "ha" "ha" "ha" "ha"]
3593 Comedic vector.
3594 \f
3595 JNAME:    Return the Job name of the MUDDLE
3596
3597 Object-type:  SUBR
3598
3599 Category:  SYSTEM
3600
3601 Reference:  UNAME
3602
3603      Returns the JNAME, or Job-name of the MUDDLE.  This is a STRING
3604 giving the JNAME, which is the second name of the job in which the
3605 MUDDLE is running.  The UNAME (qv) is the first.
3606
3607 Argument:
3608
3609   Template:  #DECL ("VALUE" STRING)
3610
3611 Returns -- A STRING which is the JNAME of the job.
3612
3613 Example:  <JNAME>
3614 Only possible example.
3615 \f
3616 L=?:      Is first argument less than or equal to the second ?
3617
3618 Object-type:  SUBR
3619
3620 Category:  PREDICATE, ARITHMETIC
3621
3622 Reference:  ==?, L?, G?, G=?
3623
3624      This routine tests if the first argument is numerically less
3625 than or equal to the second argument, returning T if it is, #FALSE()
3626 otherwise.
3627
3628 Argument:
3629
3630   Template:  #DECL ("VALUE" <OR 'T FALSE>
3631                     <OR FIX FLOAT> <OR FIX FLOAT>)
3632
3633 Argument 1 -- A FIX or FLOAT.
3634 Argument 2 -- A FIX or FLOAT.
3635 Returns -- If arg1 <= arg2, T, else #FALSE().
3636
3637 Example:  <L=? 2 12>
3638           <L=? -5.7308998 0.95000000E-2>
3639           <L=? 23 23.0>
3640 These will return T.
3641           <L=? 34 -3>
3642           <L=? 13.000100 13>
3643           <L=? -3.9530000 -4.0241000>
3644 These will return #FALSE ().
3645 \f
3646 L?:       Is first argument less than the second?
3647
3648 Object-type:  SUBR
3649
3650 Category:  PREDICATE, ARITHMETIC
3651
3652 Reference:  G?, ==?, L=?
3653
3654      This routine tests if the first argument is numerically less
3655 than the second argument.
3656
3657 Argument:
3658
3659   Template:  #DECL ("VALUE" <OR 'T FALSE>
3660                     <OR FIX FLOAT> <OR FIX FLOAT>)
3661
3662 Argument 1 -- A FIX or FLOAT.
3663 Argument 2 -- A FIX or FLOAT.
3664 Returns -- T if arg1 < arg2, #FALSE() otherwise.
3665
3666 Example:  <L? 1 2>
3667           <L? -2 4.0>
3668           <L? -13.462000 -0.93000000E-1>
3669 These will return T.
3670           <L? -12.340000 -12.340010>
3671           <L? 3.1415899 3.1415899>
3672 These will return #FALSE ().
3673 \f
3674 LEGAL?:   Is the argument (TUPLE, FRAME, etc.) legal ?
3675
3676 Object-type:  SUBR
3677
3678 Category:  PREDICATE
3679
3680      This routine is used to verify the legality of MUDDLE objects.
3681 Although it works for all MUDDLE Types, it is only really useful for
3682 the Types: TUPLE, FRAME, ACTIVATION, ENVIRONMENT, TAG, and LOCD.
3683      For these Types it will return the Atom T if the portion of the
3684 stack in which the given item is found is still active.  Otherwise, it
3685 will return #FALSE ().
3686      For any other Type it simply returns the atom T.
3687
3688 Argument:
3689
3690   Template:  #DECL ("VALUE" <OR 'T FALSE> ANY)
3691
3692 Argument 1 -- Any object, but most interestingly, TUPLE, FRAME, TAG
3693         ACTIVATION, ENVIRONMENT and LOCD, which are only legal if the
3694         part of the stack they are 'in' is still active.
3695 Returns -- T if the object is legal (for other than the types listed
3696         above this is always the result), #FALSE() otherwise.
3697
3698 Example:  <LEGAL? <PROG ("NAME" FOO) .FOO>>
3699 This will be False, since the activation is not legal outside the PROG.
3700           <PROG ("NAME" FOO) <LEGAL? .FOO>>
3701 However, this will be True, since the activation is legal inside the
3702 PROG.
3703 \f
3704 LENGTH:   Number of elements in a structure
3705
3706 Object-type:  SUBR
3707
3708 Category:  DATA-HANDLING
3709
3710 Reference:  LENGTH?
3711
3712      LENGTH returns the number of elements in a structure.
3713      Be careful, LENGTH of a circular list never returns.  For such
3714 cases consider LENGTH?, which allows you to specify a maximum length
3715 to check.
3716
3717 Argument:
3718
3719   Template:  #DECL ("VALUE" FIX STRUCTURED)
3720
3721 Argument 1 -- Any structured object.
3722 Returns -- FIX, giving number of elements.
3723
3724 Example:  <LENGTH <SET X (1 2 3 4 5)>>
3725           5
3726 Winnage.
3727           <LENGTH <PUTREST <REST .X 4> .X>>
3728 Never returns, X is circular now.
3729 \f
3730 LENGTH?:  Is a structure less than or equal to a given length?
3731
3732 Object-type:  SUBR
3733
3734 Category:  DATA-HANDLING
3735
3736 Reference:  LENGTH
3737
3738      LENGTH? has a very misleading name.  It takes a structured
3739 object and a FIX, and if the length of the s.o. is less than or equal
3740 to the FIX, it returns the length.  Otherwise it returns FALSE.
3741      It is very common to see people attempt to program with this
3742 SUBR as though it were equivalent to either <==? <LENGTH s.o.> fix>
3743 or alternatively <G=? <LENGTH s.o.> fix>.  Neither of these are what
3744 it does.  It is actually closer to <L=? <LENGTH s.o.> fix>.
3745      LENGTH? derives its specialness from the fact that it works
3746 incrementally on LISTs, counting elements until the end is reached or
3747 the count runs out.  Thus, LENGTH? will not die horribly on circular
3748 LISTs, which LENGTH will.
3749
3750 Argument:
3751
3752   Template:  #DECL ("VALUE" <OR FIX FALSE> STRUCTURED FIX)
3753
3754 Argument 1 -- A Structured Object.
3755 Argument 2 -- A FIX.
3756 Returns -- length of s.o. if less than or equal to FIX, and
3757         FALSE otherwise.
3758
3759 Example:  <SET FOO
3760                <PUTREST <REST <SET FOO (1 2 3)> 2>
3761                         .FOO>>
3762 Returns circular list.
3763           <LENGTH .FOO>
3764 Will never return.
3765           <LENGTH? .FOO 69>
3766           #FALSE ()
3767 Will work.
3768 \f
3769 LINK:     Give an object a synonym
3770
3771 Object-type:  SUBR
3772
3773 Category:  I/O, IDENTIFIER
3774
3775      LINK gives a MUDDLE expression a synonym.  It causes an object
3776 that looks vaguely like an ATOM to be placed in an OBLIST.  This type,
3777 LINK, has the property that when it is read, its value is immediately
3778 substituted for what was read.  This is particularly useful in inter-
3779 active work with MUDDLE, to avoid having to type long and dull streams
3780 of characters.  See 'Example' for the canonication application.
3781
3782 Argument:
3783
3784   Template:  #DECL ("VALUE" ANY ANY STRING "OPTIONAL" OBLIST)
3785
3786 Argument 1 -- The expression which is the value of the LINK, and which
3787         is substituted whenever the LINK is read.
3788 Argument 2 -- A STRING giving the 'PNAME' of the LINK (remember, they
3789         are somewhat like ATOMs).
3790 (Optional)
3791 Argument 3 -- An OBLIST for the LINK to live on, default <1 .OBLIST>.
3792 Returns -- Argument 1.
3793
3794 Example:  <LINK '<ERRET> "\ 5">
3795 Links the ATOM of PNAME ^E to <ERRET>.
3796 \f
3797 LIST:     Create a LIST
3798
3799 Object-type:  SUBR
3800
3801 Category:  DATA-HANDLING
3802
3803      LIST creates a list having explicit elements.  Note that this is
3804 a SUBR, so the elements will be evaluated.
3805
3806 Argument:
3807
3808   Template:  #DECL ("VALUE" LIST "TUPLE" <TUPLE [REST ANY]>)
3809
3810 Tuple of arguments -- ANY, the elements
3811
3812 Example:  <SET X <LIST 1 2 3 4 5>>
3813 equivalent to (1 2 3 4 5)
3814           <==? .X <LIST !.X>>
3815           #FALSE ()
3816           <==? .X (!.X)>
3817           T
3818
3819 Slight difference does exist between explicit application of LIST and
3820 using parens.
3821 \f
3822 LISTEN:   Go to a subsidiary READ-EVAL-PRINT loop
3823
3824 Object-type:  SUBR
3825
3826 Category:  I/O, PROGRAM-CONTROL
3827
3828 Reference:  READ, EVAL, PRINT, TTYECHO, ECHOPAIR
3829
3830 LISTEN is seldom called from a program (rather ERROR is), but it
3831 (1) ensures that .INCHAN, .OUTCHAN, and .OBLIST are reasonable
3832 (2) does <TTYECHO .INCHAN T> and <ECHOPAIR .INCHAN .OUTCHAN>
3833 (3) PRINTs its arguments on .OUTCHAN
3834 (4) PRINTs LISTENING-AT-LEVEL l PROCESS p INT-LEVEL i [as appropriate]
3835 (5) Either does <APPLY <VALUE REP>> or drops into a READ-EVAL-PRINT 
3836     loop.
3837
3838 Argument:
3839
3840   Template:  #DECL ("VALUE" ANY "TUPLE" TUPLE)
3841
3842 Tuple of arguments -- objects to print before listening
3843 Returns -- the argument to ERRET that makes the LISTEN return
3844
3845 Example:  <LISTEN "LISTEN UP, YOU YOYOS!">
3846 not an overly stupid example
3847 \f
3848 LLOC:     Get a Locative to the LVAL of an ATOM
3849
3850 Object-type:  SUBR
3851
3852 Category:  DATA-HANDLING
3853
3854 Reference:  GLOC
3855
3856      LLOC of an ATOM returns a locative (type LOCD) to the LVAL of
3857 the ATOM in the current environment, or, optionally, if a second arg
3858 is given, the LVAL in that environment.  The locative
3859 returned is independent of future rebindings of the ATOM.  IN will
3860 always return the same value as long as that binding still exists.
3861 Once it ceases to exist, IN of that locative is no longer LEGAL?.
3862
3863 Argument:
3864
3865   Template:  #DECL ("VALUE" LOCD ATOM "OPTIONAL"
3866                     <OR ENVIRONMENT ACTIVATION FRAME PROCESS>)
3867
3868 Argument 1 -- An ATOM
3869 (Optional)
3870 Argument 2 -- An Environment.  If not given, the current one.
3871 Returns -- A locative (type LOCD) to the binding specified.
3872
3873 Example:  <PROG ((X 3) (XL <LLOC X>))
3874                 <PROG ((X 69105)) <PRINT <IN .XL>>>>
3875 Will always print 3.
3876 \f
3877 LOAD:     READ and EVAL every object from a channel
3878
3879 Object-type:  SUBR
3880
3881 Category:  I/O
3882
3883 Reference:  FLOAD, READ, EVAL
3884
3885         LOAD READs and EVALs every object in the file pointed to by
3886 its channel argument, and closes the channel.  Control characters in
3887 the file have no special meaning.  An oblist can be given for looking
3888 up atoms.
3889
3890 Argument:
3891
3892   Template:  #DECL ("VALUE" '"DONE" CHANNEL "OPTIONAL"
3893                     <OR OBLIST <LIST [REST <OR OBLIST 'DEFAULT>]>>)
3894
3895 Argument 1 -- the channel to load from
3896 (Optional)
3897 Argument 2 -- (list of) oblist(s) for looking up atoms
3898 Returns -- "DONE"
3899
3900 Example:  <LOAD <OPEN "READ" "MANY ATOMS"> <ROOT>>
3901 make yourself root-bound
3902 \f
3903 LOCATIVE?: Is an object a locative?
3904
3905 Object-type:  SUBR
3906
3907 Category:  TYPE, PREDICATE
3908
3909 Reference:  TYPE, STRUCTURED?, APPLICABLE?
3910
3911      LOCATIVE? returns T if its argument is a locative, and FALSE if
3912 it is not.  Since most of the locative related SUBRs (such as IN) take
3913 any sort of locative, and since there are several different types of
3914 locatives, it is a useful SUBR.
3915
3916 Argument:
3917
3918   Template:  #DECL ("VALUE" <OR FALSE 'T> ANY)
3919
3920 Argument 1 -- Any MUDDLE object.
3921 Returns -- T argument 1 is a locative, or FALSE if it is not.
3922
3923 Example:  <LOCATIVE? <GLOC ROOT>>
3924           T
3925           <LOCATIVE? <AT [1 2 3] 1>>
3926           T
3927           <LOCATIVE? <LLOC REDEFINE>>
3928           T
3929 All are locatives.
3930 \f
3931 LOG:      Logarithms to the base 'e'
3932
3933 Object-type:  SUBR
3934
3935 Category:  ARITHMETIC
3936
3937 Reference:  EXP
3938
3939      LOG takes a FIX or FLOAT and returns the Logarithm to the base
3940 e of that FIX or FLOAT, as a FLOAT.  EXP is the opposite of LOG.
3941
3942 Argument:
3943
3944   Template:  #DECL ("VALUE" FLOAT <OR FIX FLOAT>)
3945
3946 Argument 1 -- A FIX or FLOAT to take the LOG of.
3947 Returns -- The log base e of argument 1.
3948
3949 Example:  <EXP <LOG 2>>
3950           2.0
3951 Note conversion to floating point number.
3952 \f
3953 LOGOUT:   Log out a top-level MUDDLE
3954
3955 Object-type:  SUBR
3956
3957 Category:  SYSTEM
3958
3959 Reference:  VALRET, QUIT
3960
3961      This subr causes the MUDDLE it is in to attempt to log out.
3962 This will only work if the MUDDLE is top-level.  Otherwise it will
3963 return FALSE.
3964
3965 Argument:
3966
3967   Template:  #DECL ("VALUE" FALSE)
3968
3969 Returns -- A FALSE, if it returns.
3970
3971 Example:  <LOGOUT>
3972 Never returns if it wins.
3973 \f
3974 LOOKUP:   Look up an ATOM in an OBLIST
3975
3976 Object-type:  SUBR
3977
3978 Category:  IDENTIFIER
3979
3980 Reference:  ATOM, INSERT, OBLIST?
3981
3982      LOOKUP takes the PNAME of an ATOM and an OBLIST as arguments,
3983 and looks to see if an ATOM with that PNAME exists on the OBLIST
3984 given.  If one does, it is returned.  If not, FALSE.
3985      LOOKUP is often used in conjunction with INSERT.
3986
3987 Argument:
3988
3989   Template:  #DECL ("VALUE" <OR ATOM FALSE> STRING OBLIST)
3990
3991 Argument 1 -- A STRING which represents the PNAME of an ATOM.
3992 Argument 2 -- An OBLIST to look up the PNAME in.
3993 Returns -- The ATOM found or FALSE if there wasn't one.
3994
3995 Example:  <OR <LOOKUP "FOO" .OB>
3996               <INSERT "FOO" .OB>>
3997
3998 Recommended way of safely inserting ATOMs.  Guaranteed to return the
3999 ATOM of pname "FOO".
4000 \f
4001 LPARSE:   PARSE several objects into a LIST.
4002
4003 Object-type:  SUBR
4004
4005 Category:  DATA-HANDLING
4006
4007 Reference:  PARSE
4008
4009      PARSE takes from 0 to 5 arguments.  If parse is given no arguments,
4010 it returns the first item parsed from the local value of the string
4011 PARSE-STRING, and additionally, sets PARSE-STRING to the string having
4012 those characters which were parsed rested off.  If parse is given a
4013 string to parse, the atom, PARSE-STRING, is rebound to the string within
4014 that call.  If the parse table argument is given to PARSE, the value of
4015 PARSE-TABLE is rebound to it within that call to PARSE.  Finally, PARSE
4016 takes a look ahead character, which is treated as if it were logically
4017 concatenated to the front of the string being parsed.  The full callling
4018 sequence of PARSE is:
4019
4020    <PARSE string radixfornumberconversion oblistorlistofoblists
4021            parsetable lookaheadchar> 
4022
4023      LPARSE is called exactly the same way as PARSE is called.
4024 It tries to parse the whole string, returning a list of the items
4025 parsed.  The same action is taken with respect to optional
4026 arguments and rebindings as is taken by PARSE.  All arguments are
4027 optional.   The full calling sequence of LPARSE is:  
4028
4029    <LPARSE string radixfornumberconversion oblistorlistofoblists
4030            parsetable lookaheadchar> 
4031
4032
4033 Argument:
4034
4035   Template:  #DECL ("VALUE" LIST "OPTIONAL" STRING
4036                     FIX <OR OBLIST
4037                             <LIST [REST <OR OBLIST 'DEFAULT>]>>
4038                     VECTOR CHARACTER)
4039
4040 (Optional arguments)
4041 Argument 1 -- A STRING to be PARSEd.
4042 Argument 2 -- FIX radix for number conversion.
4043 Argument 3 -- An OBLIST or LIST of OBLISTs.
4044 Argument 4 -- A Parse-table (VECTOR).
4045 Argument 5 -- A CHARACTER for lookahead.
4046 Returns -- A LIST of objects.
4047
4048 Example:  <LPARSE "() 1 A">
4049           (() 1 A)
4050 Will return a list of three elements.
4051 \f
4052 LSH:     Logical shift
4053
4054 Object-type:  SUBR
4055
4056 Category:  BIT-TWIDDLING, LOGICAL
4057
4058 Reference:  ROT
4059
4060      LSH takes an object of Primtype WORD and a FIX, and it returns a
4061 WORD containing the bits in the first argument, shifted left (positive
4062 argument) or right (negative argument) the number of bits specified by
4063 the second argument (mod 256).  Zero bits are brought in at the end
4064 being vacated; bits shifted out at the other end are lost.
4065
4066 Argument:
4067
4068   Template:  #DECL ("VALUE" WORD
4069                     <PRIMTYPE WORD> FIX)
4070
4071 Arg 1 -- a Primtype WORD containing the bits to shift
4072 Arg 2 -- a FIX specifying the amount to shift
4073 Returns -- A WORD containing the shifted bits.
4074
4075 Example:  <LSH 8 6>
4076           #WORD *000000001000*
4077           <LSH 8 -6>
4078           #WORD *000000000000*
4079 Primarily useful for getting fingers directly in the bits.
4080 \f
4081 LVAL:     Get the local value of an atom
4082
4083 Object-type:  SUBR
4084
4085 Category:  IDENTIFIER
4086
4087 Reference:  ASSIGNED?, LLOC
4088
4089         LVAL gets the local value of its atom argument, relative to its
4090 environment argument.  With only one arg, it can be written .<-atom-> .
4091
4092 Argument:
4093
4094   Template:  #DECL ("VALUE" ANY ATOM "OPTIONAL"
4095                     <OR ENVIRONMENT ACTIVATION FRAME PROCESS>)
4096
4097 Argument 1 -- the atom whose local value is desired
4098 (Optional)
4099 Argument 2 -- the environment in which to find a value
4100 Returns -- the value
4101
4102 Example:  .INCHAN
4103 default input channel
4104 \f
4105 MAIN:     Returns the main MUDDLE process
4106
4107 Object-type:  SUBR
4108
4109 Category:  PROCESS-CONTROL
4110
4111 Reference:  ME
4112
4113      MAIN returns the initial MUDDLE PROCESS.  This is always
4114 PROCESS 1, and cannot be terminated.
4115
4116 Argument:
4117
4118   Template:  #DECL ("VALUE" PROCESS)
4119
4120 Returns -- The initial, PROCESS 1, PROCESS of the MUDDLE.
4121
4122 Example:  <==? <MAIN> <ME>>
4123 Is the PROCESS I am in the main process?
4124 \f
4125 MANIFEST: Declare the global value of an ATOM to be a constant
4126
4127 Object-type:  SUBR
4128
4129 Category:  DATA-HANDLING
4130
4131 Reference:  MANIFEST?, GDECL
4132
4133      MANIFEST declares that the current global value of an ATOM is
4134 a constant.  Any attempt to SETG it will generate an error, assuming
4135 that DECL-checking is on.
4136      MANIFEST is useful to the compiler because if an ATOM is a
4137 constant its value may be placed directly into the RSUBR, and thus
4138 references to it will be considerably faster.  Note that manifesting
4139 a FIX will make applications of it (NTH's, that is) open-compile.
4140      It is not usually a good idea to MANIFEST a GVAL that is large
4141 and complex and used by several FUNCTIONs -- each FUNCTION will get
4142 a copy of it in the result RSUBR.
4143
4144 Argument:
4145
4146   Template:  #DECL ("VALUE" 'T "TUPLE" <TUPLE [REST ATOM]>)
4147
4148 Tuple of arguments -- ATOMs whose GVALs are constants.
4149 Returns -- T.
4150
4151 Example:  <SETG A 1>
4152           <SETG B 2>
4153           <MANIFEST A B>
4154 Most common use of MANIFEST.
4155 \f
4156 MANIFEST?: Has an ATOM been MANIFESTed?
4157
4158 Object-type:  SUBR
4159
4160 Category:  DATA-HANDLING, PREDICATE
4161
4162 Reference:  MANIFEST, UNMANIFEST
4163
4164      MANIFEST? returns T if its argument (an ATOM) has been MANIFESTed,
4165 and #FALSE () otherwise.
4166
4167 Argument:
4168
4169   Template:  #DECL ("VALUE" <OR 'T FALSE> ATOM)
4170
4171 Argument 1 -- An ATOM.
4172 Returns -- T if it is MANIFEST, FALSE if it is not.
4173
4174 Example:  <SETG FOO 1>
4175           <MANIFEST FOO>
4176           <MANIFEST? FOO>
4177           T
4178           <UNMANIFEST FOO>
4179           <MANIFEST? FOO>
4180           #FALSE ()
4181 Make it a constant, then make it not a constant.
4182 \f
4183 MAPF:     Map routine onto elements of structured objects.
4184
4185 Object-type:  SUBR
4186
4187 Category:  PROGRAM-CONTROL
4188
4189 Reference:  MAPR, MAPRET, MAPSTOP, MAPLEAVE
4190
4191      This is used to map, or apply, a routine to succesive elements
4192 of one or more structured objects.  This routine is the second argument
4193 to MAPF and it must take n args, where n is the number of structured
4194 args supplied to the MAPF.  In addition another routine can be supplied
4195 to be applied to the results of all of the previous applications.
4196 Usually this routine will take an arbitrary number of arguments.  This
4197 secondary routine is given as the first argument to MAPF.  However, if
4198 #FALSE () is supplied as the first argument, this indicates that no
4199 such additional application is desired.
4200      Finally the desired structured arguments for mapping are supplied
4201 after the first two arguments.
4202      The primary routine is repeatedly applied to a bunch of the
4203 successive elements from all the structured objects supplied.  The
4204 bunch consists of exactly one element from each of the structured
4205 objects.
4206      The repeated application continues until one of the structured
4207 objects runs out of elements for the application, OR until the MAPF is
4208 stopped within the application by use of the SUBRs MAPSTOP or MAPLEAVE.
4209      Note that at least one such structured object must be supplied.
4210      The value returned by the MAPF is the result returned by the
4211 application of the additional routine, if any.
4212      If the additional routine is not supplied (the first arg is
4213 #FALSE ()), the value returned is the result of the last application
4214 of the primary routine to the last bunch of elements.
4215
4216 Argument:
4217
4218   Template:  #DECL ("VALUE" ANY <OR FALSE APPLICABLE> APPLICABLE
4219                     "TUPLE" <TUPLE STRUCTURED [REST STRUCTURED]>)
4220
4221 Argument 1 -- An applicable object to be used after the mapping phase
4222         is finished, or a FALSE, to simply finish.
4223 Argument 2 -- An applicable object to apply to the elements of the
4224         structured objects.
4225 Tuple of arguments -- At least one structured object, whose elements
4226         will be passed in order as arguments to the second argument of
4227         MAPF.
4228 Returns -- Either the result of APPLYing the first argument to the
4229         stacked results of the repeated application of the second
4230         argument, or the last thing returned by applying the second
4231         argument, or #FALSE () if all of the structured objects were
4232         empty.
4233
4234 Example:  <MAPF ,LIST ,+ '(1 2 3 4) '(10 11 12 13)>
4235 This will perform the element-wise sum of two lists
4236 \f
4237 MAPLEAVE: Leave from the current MAPF/MAPR with a given value.
4238
4239 Object-type:  SUBR
4240
4241 Category:  PROGRAM-CONTROL
4242
4243 Reference:  MAPF, MAPR, MAPRET, MAPSTOP
4244
4245      Leaves from the current MAPF/MAPR without doing the normal
4246 application of a routine to the stacked args.  If the optional argument
4247 to MAPLEAVE is supplied, it will be the result of the MAPF/MAPR.
4248      If no such argument is supplied the Atom T will be used instead.
4249
4250 Argument:
4251
4252   Template:  #DECL ("VALUE" ANY "OPTIONAL" ANY)
4253
4254 (Optional)
4255 Argument 1 -- The result of the MAPF/R.  If not given, T will be used.
4256 Returns -- Nothing.  Terminates a MAPF/R.
4257
4258 Example:  <MAPF <>
4259                 <FUNCTION (X) 
4260                         <COND (<N==? .X 0> <MAPLEAVE .X>)>>
4261                 .STRUC>
4262 This example will find and return the first non-zero element of STRUC
4263 \f
4264 MAPR:     Map routine onto RESTs of structured objects.
4265
4266 Object-type:  SUBR
4267
4268 Category:  PROGRAM-CONTROL
4269
4270 Reference:  MAPF, MAPRET, MAPSTOP, MAPLEAVE
4271
4272      This is used to map, or apply, a routine to succesive RESTs of
4273 one or more structured objects.
4274      Works just like MAPF, see its description, except that instead
4275 of applying the second arg to the elements of the structured objects,
4276 MAPR applys the second arg to the successive RESTs of the structured
4277 objects.  This makes it possible to change the arguments that will be
4278 passed to future applications of the second argument before they are
4279 reached.
4280
4281 Argument:
4282
4283   Template:  #DECL ("VALUE" ANY <OR FALSE APPLICABLE> APPLICABLE
4284                     "TUPLE" <TUPLE STRUCTURED [REST STRUCTURED]>)
4285
4286 Argument 1 -- FALSE or an applicable object to apply to the results
4287         of the repeated applications of the second argument.
4288 Argument 2 -- An applicable object to apply repeatedly to the RESTs of
4289         the remaining arguments.
4290 Tuple of arguments -- At least one structured object to supply RESTs
4291         for the second argument.
4292 Returns -- The result of applying argument 1 to the results of the
4293         repeated applications of argument 2, or the result of the last
4294         such application if argument 1 is FALSE, or #FALSE () if all the
4295         structures were empty and no applications were performed.
4296
4297 Example:  <MAPR <>
4298                 <FUNCTION (OB) 
4299                         <PUT .OB 1 <* <1 .OB> 2>>>
4300                 .STRUC>
4301 This will change the structure STRUC to contain double its values.
4302 \f
4303 MAPRET:   Return an arbitrary number of objects to a MAPF/MAPR.
4304
4305 Object-type:  SUBR
4306
4307 Category:  PROGRAM-CONTROL
4308
4309 Reference:  MAPF, MAPR, MAPSTOP, MAPLEAVE
4310
4311      This routine is used to return an arbitrary number of elements
4312 to the current MAPF/R.  An invocation of MAPRET ends the current
4313 application of the second argument of MAPF/R.  The arguments to MAPRET
4314 are added to the objects being collected to be passed as arguments to
4315 the application of the first argument to MAPF/R.
4316      MAPRET makes it possible to return no arguments or several argu-
4317 ments from one of these intermediate applications.
4318
4319 Argument:
4320
4321   Template:  #DECL ("VALUE" ANY "TUPLE" <TUPLE [REST ANY]>)
4322
4323 Tuple of arguments -- Any number of objects to be added to the group
4324         of potential arguments to the ending application of a MAPF/R.
4325 Returns -- Nothing, really, as the application is ended by MAPRET.
4326
4327 Example:  <MAPRET>
4328 This is used when one desires to return nothing.
4329 \f
4330 MAPSTOP:  Stop looping of the current MAPF/MAPR and do the application.
4331
4332 Object-type:  SUBR
4333
4334 Category:  PROGRAM-CONTROL
4335
4336 Reference:  MAPF, MAPR, MAPRET, MAPLEAVE
4337
4338      First this Subr acts like MAPRET and causes an arbitrary number
4339 of MUDDLE objects to be stacked for the current MAPF/MAPR.  Then it
4340 stops the normal looping operation of this MAPF/MAPR and causes the
4341 normal application of the previously saved applicative object to the
4342 current group of stacked objects.
4343      The result of this application is then returned as the result
4344 of the MAPF/MAPR.
4345
4346 Argument:
4347
4348   Template:  #DECL ("VALUE" ANY "TUPLE" <TUPLE [REST ANY]>)
4349
4350 Tuple of arguments -- Any number of arguments to add to the stacked
4351         objects that the final application will apply to.
4352 Returns -- Nothing, terminates MAPF/R looping.
4353
4354 Example:  <PROG ((I 10))
4355                 <MAPF ,LIST
4356                  <FUNCTION (X) 
4357                          <COND (<L? <SET I <- .I 1>> 0>
4358                                 <MAPSTOP>)>
4359                          .X>
4360                  .STRUC>>
4361
4362 This example produces a list out of the first ten elements of STRUC.
4363 If there are fewer than ten elements in STRUC, then all are used.
4364 \f
4365 MAX:      Maximum of a set of numbers
4366
4367 Object-type:  SUBR
4368
4369 Category:  ARITHMETIC
4370
4371 Reference:  MIN
4372
4373      MAX (Maximum) takes any number of FIXes or FLOATs, and returns
4374 the greatest as its result.  If any of the arguments are FLOATs, the
4375 result will be FLOAT.  If no argument is given, MAX returns the least
4376 floating-point number.  If one argument is given, MAX returns that
4377 argument.
4378
4379 Argument:
4380
4381   Template:  #DECL ("VALUE" <OR FIX FLOAT>
4382                     "TUPLE" <TUPLE [REST <OR FIX FLOAT>]>)
4383
4384 (Optional)
4385 Tuple of arguments -- FIXes and FLOATs
4386 Returns -- FIX or FLOAT, floating is contagious.
4387
4388 Example:  <MAX 1 2.0>
4389           2.0
4390 Floating is contagious.
4391 \f
4392 ME:       Returns the process id of the the current process
4393
4394 Object-type:  SUBR
4395
4396 Category:  PROCESS-CONTROL
4397
4398 Reference:  MAIN, RESUMER
4399
4400      ME is similar to MAIN, except that it returns the PROCESS ID of
4401 the process it is evaled in, rather than the initial process.
4402
4403 Argument:
4404
4405   Template:  #DECL ("VALUE" PROCESS)
4406
4407 Returns -- The PROCESS Id of the PROCESS it is EVALed in.
4408
4409 Example:  <==? <MAIN> <ME>>
4410 Am I the main process?
4411 \f
4412 MEMBER:   Is there a similar object in a structure?
4413
4414 Object-type:  SUBR
4415
4416 Category:  PREDICATE
4417
4418 Reference:  MEMQ, =?
4419
4420      MEMBER is used to find a structural copy of an object in a
4421 structure.  It takes as arguments and object and a structure.  Each
4422 element of the structure is examined in turn, using =?, and if one of
4423 them is =? to the object, the structure is returned, RESTed down to a
4424 point where its first element is the copy.
4425      If no element is structurally identical to the first argument,
4426 #FALSE() is returned.
4427
4428 Argument:
4429
4430   Template:  #DECL ("VALUE" <OR FALSE STRUCTURED> ANY STRUCTURED)
4431
4432 Argument 1 -- Any MUDDLE object.
4433 Argument 2 -- A STRUCTURED object.
4434 Returns -- Either the structure RESTed down to the copy, or FALSE if
4435         there is no copy.
4436
4437 Example:  <MEMBER 69 [105 104 32 69 81]>
4438           [69 81]
4439 MEMQ would do the same for this example.
4440           <MEMBER "FOO" ["BAR" "FOO" "BLECH"]>
4441 But not for this example.  Different strings are =? not ==?.
4442 \f
4443 MEMQ:     Is there an identical object in a structure?
4444
4445 Object-type:  SUBR
4446
4447 Category:  PREDICATE
4448
4449 Reference:  MEMBER, ==?
4450
4451      MEMQ is used to find a copy of an object in a structure.  It
4452 takes as arguments and object and a structure.  Each element of the
4453 structure is examined in turn, using ==?, and if one of them is ==?
4454 to the object, the structure is returned, RESTed down to a point
4455 where its first element is the copy.
4456      If no element is identical to the first argument, #FALSE() is
4457 returned.
4458
4459 Argument:
4460
4461   Template:  #DECL ("VALUE" <OR FALSE STRUCTURED> ANY STRUCTURED)
4462
4463 Argument 1 -- Any MUDDLE object.
4464 Argument 2 -- A STRUCTURED object.
4465 Returns -- Either the structure RESTed down to the copy, or FALSE if
4466         there is no copy.
4467
4468 Example:  <MEMQ 69 [105 104 32 69 81]>
4469           [69 81]
4470 The copy is now the first element.
4471 \f
4472 MIN:      Minumum of a set of numbers
4473
4474 Object-type:  SUBR
4475
4476 Category:  ARITHMETIC
4477
4478 Reference:  MAX
4479
4480      MIN (Minimum) takes any number of FIXes or FLOATs, and returns
4481 the least as the result.  If no argument is given, MIN returns the
4482 greatest floating-point number; if one argument is given, MIN returns
4483 that argument.
4484      If any of the arguments is a FLOAT, the result will be a FLOAT,
4485 no matter what type it was originally.
4486
4487 Argument:
4488
4489   Template:  #DECL ("VALUE" <OR FIX FLOAT>
4490                     "TUPLE" <TUPLE [REST <OR FIX FLOAT>]>)
4491
4492 (Optional)
4493 Tuple of arguments -- FIXes and FLOATs
4494 Returns -- FIX or FLOAT, depending on whether any args were FLOAT.
4495
4496 Example:  <MIN 1 2.0>
4497           1.0
4498 Takes any number of args
4499 \f
4500 MOBLIST:  Create an OBLIST
4501
4502 Object-type:  SUBR
4503
4504 Category:  DATA-HANDLING
4505
4506 Reference:  BLOCK
4507
4508      MOBLIST creates an oblist--repository for atoms.  It is not put
4509 anywhere automatically.  If the user wants it in his oblist path, that
4510 must be done explicitly, as in the example.
4511      Note that it is the location of the ATOM passed as argument to
4512 MOBLIST that determines where the new OBLIST will exist.
4513      An association is automatically created for the oblist under the
4514 atom and the indicator OBLIST.  Note that this association is checked
4515 by MOBLIST, and a new OBLIST will not be created if one already exists
4516 with the name given.
4517
4518 Argument:
4519
4520   Template:  #DECL ("VALUE" OBLIST ATOM "OPTIONAL" FIX)
4521
4522 Argument 1 -- ATOM, name of OBLIST.
4523 (Optional)
4524 Argument 2 -- FIX, number of hashing buckets, default 13
4525 Returns -- New OBLIST, or old one if one already exists with that name.
4526
4527 Example:  <PROG ((OBLIST (<MOBLIST MY-OBLIST> !.OBLIST)))
4528                 AN-ATOM!-MY-OBLIST
4529                 <GET MY-OBLIST OBLIST>>
4530 The oblist is placed in the path by the setting of the atom OBLIST
4531 \f
4532 MOD:      Take a number modulus another number
4533
4534 Object-type:  SUBR
4535
4536 Category:  ARITHMETIC
4537
4538      MOD (Modulus) takes two FIXes and returns the remainder when the
4539 first is divided by the second.  This is the standard arithmetic Mod
4540 operation.
4541
4542 Argument:
4543
4544   Template:  #DECL ("VALUE" FIX FIX FIX)
4545
4546 Argument 1 -- A FIX.
4547 Argument 2 -- A FIX.
4548 Returns -- FIX, remainder of argument 1 divided by argument 2.
4549
4550 Example:  <MOD <RANDOM> 30>
4551 How to get a random number between 0 and 30.
4552 \f
4553 MONAD?:   Will NTH and REST fail on this object?
4554
4555 Object-type:  SUBR
4556
4557 Category:  PREDICATE
4558
4559 Reference:  STRUCTURED?, EMPTY?
4560
4561      MONAD? returns T if and only if NTH and REST will fail on the
4562 object passed as its argument.  Obviously this is true of any non-
4563 structured object, but additionally, MONAD? returns T if its argument
4564 is an empty structured object.
4565      MONAD? is thus similar to ORing <NOT <STRUCTURED? object>> and
4566 <EMPTY? object>.
4567
4568 Argument:
4569
4570   Template:  #DECL ("VALUE" <OR 'T FALSE> ANY)
4571
4572 Argument 1 -- Any MUDDLE object.
4573 Returns -- T if NTH and REST will not work on the object, FALSE if
4574         they will work.
4575
4576 Example:  <OR <NOT <STRUCTURED? .FOO>>
4577               <EMPTY? .FOO>>
4578           <MONAD? .FOO>
4579 Result is the same for these two forms.
4580 \f
4581 N==?:     Test for physical non-identity of two objects.
4582
4583 Object-type:  SUBR
4584
4585 Category:  PREDICATE
4586
4587 Reference:  =?, ==?
4588
4589     N==? is the logical complement of ==?.  For every case in which
4590 ==? would return T, N==? returns #FALSE() and vice versa.
4591      ==? tests two objects for physical identity.  For ==? to return
4592 T (true), the two objects must have the same identical type-value pair.
4593 For example, two STRINGs typed in from the console will not be ==?, but
4594 two ATOMS, FIXes, or nil LISTs will be.
4595      If the two objects are not the same, ==? returns FALSE.
4596
4597 Argument:
4598
4599   Template:  #DECL ("VALUE" <OR 'T FALSE> ANY ANY)
4600
4601 Argument 1 -- Any object.
4602 Argument 2 -- Another object.
4603 Returns -- T if the two objects are different objects, FALSE otherwise.
4604
4605 Example:  <N==? "FOO" "FOO">
4606           T
4607 These two STRINGs look identical, but are not.
4608 \f
4609 N=?:      Test for structural non-identity of two objects.
4610
4611 Object-type:  SUBR
4612
4613 Category:  PREDICATE
4614
4615 Reference:  =?, N==?
4616
4617      N=? is the logical complement of =?.  For every case in which
4618 N==? returns T, =? would have returned FALSE, and vice versa.
4619      =? is a less stringent, but more expensive, test for identity
4620 than ==?.  It also takes two objects as arguments, but tests only for
4621 structural identity of the objects, rather than physical identity.  If
4622 two objects print the same, they will be =? to each other, except for
4623 numeric fuzz.  For example, two STRINGs typed in from the console will
4624 be =? to each other, but not ==?.  Any objects that are ==? will also
4625 be =?, and if ==? applies, it should be used.  =? is much more
4626 expensive than ==?, in general, as it must test an entire structure
4627 piece by piece.
4628      =? returns T if the objects are structurally identical, and FALSE if
4629 they are not.
4630
4631 Argument:
4632
4633   Template:  #DECL ("VALUE" <OR 'T FALSE> ANY ANY)
4634
4635 Argument 1 -- Any object.
4636 Argument 2 -- Any other object.
4637 Returns -- T if the arguments are not structurally equal, FALSE if they
4638         are.
4639
4640 Example:  <N=? <SET V <VECTOR 1 2 3>> <EVAL .V>>
4641           #FALSE ()
4642 If the test were =?, the result would be T.
4643 \f
4644 NETACC:   Network Listening socket accept
4645
4646 Object-type:  SUBR
4647
4648 Category:  NETWORK
4649
4650 Reference:  OPEN, NETSTATE, NETS
4651
4652      NETACC takes a network listening socket and accepts a connection.
4653 It will return FALSE if the connection is in the wrong state.
4654
4655 Argument:
4656
4657   Template:  #DECL ("VALUE" <OR FALSE CHANNEL> CHANNEL)
4658
4659 Argument 1 -- A Network channel (a listening socket).
4660 Returns -- The channel, or FALSE if it is in the wrong state.
4661
4662 Example:  <NETACC <OPEN "READ" -1 -1 "NET">>
4663 Accept the listening socket.
4664 \f
4665 NETS:     Force out the Network buffers of a Network channel
4666
4667 Object-type:  SUBR
4668
4669 Category:  NETWORK
4670
4671 Reference:  OPEN, NETSTATE, NETACC
4672
4673      NETS forces any system buffered network output to be sent.  The ITS
4674 system normally does this every 1/2 second anyway.  Note that this is
4675 similar to the function of BUFOUT for normal channels but more thorough.
4676
4677 Argument:
4678
4679   Template:  #DECL ("VALUE" CHANNEL CHANNEL)
4680
4681 Argument 1 -- A Network channel.
4682 Returns -- The Network channel, with buffers output.
4683
4684 Example:  <NETS .NETCHAN>
4685 What else?
4686 \f
4687 NETSTATE: Return the state of an ARPA-net connection
4688
4689 Object-type:  SUBR
4690
4691 Category:  NETWORK
4692
4693 Reference:  OPEN, NETACC, NETS
4694
4695      NETSTATE returns a UVECTOR of three elements.  The first is the
4696 state of the connection, the second is a code specifying why a connection
4697 was closed, and the last is the number of bits available for input.
4698      The meaning of the state and close codes is specified in the
4699 documentation of the ITS NCP (Network Control Program).
4700
4701 Argument:
4702
4703   Template:  #DECL ("VALUE" <UVECTOR FIX FIX FIX> CHANNEL)
4704
4705 Argument 1 -- A MUDDLE channel open to the NETWORK.
4706 Returns -- A UVECTOR containing 3 FIXes, a connection state, a close
4707         code, and the number of bits available on the connection for
4708         input.
4709
4710 Example:  <NETSTATE <OPEN "READ" -1 -1 "NET">>
4711 Give state of a network channel open for listening.
4712 \f
4713 NEWTYPE:  Create a new MUDDLE type
4714
4715 Object-type:  SUBR
4716
4717 Category:  TYPE-DEFINITION
4718
4719 Reference:  ALLTYPES
4720
4721      NEWTYPE creates and specifies a new MUDDLE type.  It takes the
4722 name of the new type (an ATOM), the primtype of the new type (also an
4723 ATOM), and optionally, the DECL of the new type.
4724      A new type will print as:
4725
4726          #<name of type> <print representation of primtype>
4727
4728 For example, a <NEWTYPE FOO LIST> would make FOOs that print as:
4729
4730                         #FOO ()
4731
4732 The new type is added to the type vector (as returned by ALLTYPES),
4733 and becomes legal to DECL, etc.   Note that a newtype is not given the
4734 EVALTYPE, APPLYTYPE and so on of its primtype!  If you wish it to have
4735 these you must explicitly give them to it.  For example, the type FOO
4736 above, when EVALed, will not generate a new FOO with the elements
4737 EVALed.  To cause this to happen you must say <EVALTYPE FOO LIST>.
4738      The third (optional) argument allows you to more strongly specify
4739 the makeup of the new type.  It is a DECL-body, and it will be assoc-
4740 itated with the type-name under the indicator DECL.  Each type an
4741 object is CHTYPEd to the newtype it will be checked against the DECL,
4742 and ERROR will occur if they don't match.
4743      NEWTYPE returns the ATOM given as the name of the new type.
4744
4745 Argument:
4746
4747   Template:  #DECL ("VALUE" ATOM ATOM ATOM
4748                     "OPTIONAL" <OR ATOM <FORM 'QUOTE FORM>>)
4749
4750 Argument 1 -- The ATOM name of the new type.
4751 Argument 2 -- The ATOM name of the primtype of the new type.
4752 (Optional)
4753 Argument 3 -- The DECL of the new type.
4754 Returns -- The name of the new type (arg 1).
4755
4756 Example:  [<NEWTYPE BAR LIST>
4757            "Simple newtype"
4758            <NEWTYPE BAR
4759                     LIST
4760                     '<<PRIMTYPE LIST> BAR [REST FIX FLOAT]>>
4761            "More strongly specified, even recursive."]
4762 \f
4763 NEXT:     Access the next Association in the Association chain.
4764
4765 Object-type:  SUBR
4766
4767 Category:  ASSOCIATION
4768
4769 Reference:  ASSOCIATIONS, AVALUE, INDICATOR, ITEM
4770
4771      NEXT returns the next Association in the association chain, given
4772 an ASOC.  It is used to access associations further down the chain
4773 than the first, which must be gotten with ASSOCIATIONS.  Applying NEXT
4774 to the last association in the chain will return FALSE.
4775      ASSOCIATIONS gives the user access to the association chain in
4776 much the same way as FRAME gives access to the stack.  ASSOCIATIONS
4777 returns the first association triad (item, indicator, value) in the
4778 chain, as a type ASOC, which looks, but doesn't behave like, a LIST.
4779      An ASOC may be passed to ITEM, INDICATOR, or AVALUE to retrieve
4780 the elements of a triad, or to NEXT to retrieve the next association
4781 in the chain.
4782
4783 Argument:
4784
4785   Template:  #DECL ("VALUE" <OR FALSE ASOC> ASOC)
4786
4787 Argument 1 -- An ASOC, as returned by NEXT or ASSOCIATIONS.
4788 Returns -- The next association in the association chain, or FALSE if
4789         NEXT was passed the last association.
4790
4791 Example:  <NEXT <ASSOCIATIONS>>
4792 Get second association in chain.
4793 \f
4794 NEXTCHR:  Return the next input character from an I/O channel
4795
4796 Object-type:  SUBR
4797
4798 Category:  I/O
4799
4800 Reference:  READCHR
4801
4802         NEXTCHR returns the character which READCHR will return the
4803 next time it is called.  Successive calls, with no intervening input
4804 operations, all return the same thing.
4805
4806 Argument:
4807
4808   Template:  #DECL ("VALUE" <OR CHARACTER FIX> "OPTIONAL" CHANNEL
4809                     ANY)
4810
4811 (Optional)
4812 Argument 1 -- the channel
4813 Argument 2 -- object to eval and return at end of file
4814 Returns -- the next character (-1 if empty STY device)
4815
4816 Example:  <NEXTCHR>
4817           !\\e
4818 what you get if called by itself
4819 \f
4820 NOT:      Change the truth value of an object to its complement
4821
4822 Object-type:  SUBR
4823
4824 Category:  LOGICAL, CONDITIONAL
4825
4826 Reference:  AND, OR, COND
4827
4828      NOT complements the truth value of its argument.  If its
4829 argument was a FALSE, NOT returns T, if its argument was non-FALSE,
4830 NOT returns a FALSE.
4831
4832 Argument:
4833
4834   Template:  #DECL ("VALUE" <OR 'T FALSE> ANY)
4835
4836 Argument 1 -- ANY object.
4837 Returns -- The logical complement of the truth value of the object.
4838
4839 Example:  <NOT <NOT #FALSE ("FILE NOT FOUND")>>
4840           #FALSE ()
4841 Note the loss of detail in complementing the complement.
4842 \f
4843 NTH:      Get the Nth element of a structure
4844
4845 Object-type:  SUBR
4846
4847 Category:  DATA-HANDLING
4848
4849 Reference:  APPLY
4850
4851      NTH returns the n'th element of a stucture.  It takes the
4852 structure and the number of the element to return, where 1 is the
4853 first element, and so on.
4854      If the structure does not have an Nth element, an ERROR occurs.
4855 LENGTH can be used to help find out if a structure has an Nth element.
4856      Note that NTH is cheap on VECTORs, UVECTORs and such, and
4857 expensive on LISTs.
4858      An application of a FIX, or something that EVALs to a FIX, to
4859 a structure is equivalent to an application of NTH, assuming that the
4860 order of evaluation is not important:
4861
4862                         <NTH .X 1>
4863                 and     <1 .X>
4864 are equivalent, but
4865
4866                 <NTH .X <LENGTH <SET X .Y>>>
4867         and     <<LENGTH <SET X .Y>> .X>
4868
4869 are not equivalent, the order of evaluation makes a difference.
4870
4871 Argument:
4872
4873   Template:  #DECL ("VALUE" ANY STRUCTURED "OPTIONAL" FIX)
4874
4875 Argument 1 -- A Structured object.
4876 (Optional)
4877 Argument 2 -- A FIX, the element number to return, default 1.
4878 Returns -- The contents of the Arg-2th element of the structure.
4879
4880 Example:  <2 (4 5 6)>
4881           <NTH (4 5 6) 2>
4882
4883 The first is equivalent to the second as long
4884 as order of evaluation makes no difference.
4885 \f
4886 OBLIST?:  Return the OBLIST that contains a given ATOM
4887
4888 Object-type:  SUBR
4889
4890 Category:  IDENTIFIER, CONDITIONAL
4891
4892 Reference:  INSERT, ATOM, REMOVE
4893
4894      OBLIST? returns the OBLIST that contains a given ATOM, or FALSE
4895 if the ATOM is not on an OBLIST (hence the ?).  It is usually used for
4896 the first purpose (to find out what OBLIST an ATOM is on).
4897
4898 Argument:
4899
4900   Template:  #DECL ("VALUE" <OR OBLIST FALSE> ATOM)
4901
4902 Argument 1 -- An ATOM.
4903 Returns -- Either the OBLIST that ATOM is on, or FALSE if it is not on
4904         any OBLIST.
4905
4906 Example:  <OBLIST? FOO>
4907 ...SOME OBLIST....
4908           <OBLIST? <REMOVE FOO>>
4909           #FALSE ()
4910
4911 If you type in the ATOM as part of the form, it will naturally be on
4912 an OBLIST.
4913 \f
4914 OFF:      Turn off an interrupt IHEADER or HANDLER
4915
4916 Object-type:  SUBR
4917
4918 Category:  INTERRUPT
4919
4920      OFF permits the user to remove an IHEADER or HANDLER.  OFFing the
4921 IHEADER causes MUDDLE to completely ignore the interrupt and OFFing a
4922 HANDLER causes the function associated with that particular HANDLER
4923 not to be run.
4924      OFF may also be used with strings or atoms to identify IHEADERs
4925 as in EVENT.  As usual "CHAR" requires the channel as an additional
4926 argument, and "READ" and "WRITE" require the locative as an
4927 additional argument.
4928
4929 Argument:
4930
4931   Template:  #DECL ("VALUE" <OR FALSE IHEADER HANDLER>
4932                     <OR IHEADER HANDLER STRING ATOM> "OPTIONAL"
4933                     <OR CHANNEL LOCATIVE>)
4934
4935 Argument 1 -- An IHEADER, HANDLER, STRING or ATOM identifying exactly
4936         what interrupt or interrupt handler to remove.
4937 (Optional)
4938 Argument 2 -- If the CHAR interrupt is the one being OFFed, the
4939         channel is also needed with which the interrupt was paired.
4940         If the READ or WRITE interrupt is the one being OFFed, the
4941         locative is also needed with which the interrupt was paired.
4942 Returns -- The OFFed IHEADER or HANDLER, if successful, or FALSE if
4943         there was nothing to remove.
4944
4945 Example:  <OFF "CLOCK">
4946 Turns off the CLOCK interrupt.
4947 \f
4948 OFFSET:   Create an OFFSET
4949
4950 Object-type:  SUBR
4951
4952 Category:  STRUCTURES
4953
4954 Reference:  NTH, INDEX, GET-DECL, PUT-DECL
4955
4956      An OFFSET is a "frozen" NTH.  Given a fix and a DECL, it creates
4957 an APPLICABLE object which may be applied to structures to get the fixth
4958 element or to a structure and an object to change the fixth element to
4959 be the object.
4960
4961 Argument:
4962
4963   Template:  #DECL ("VALUE" OFFSET FIX <OR ATOM FORM>)
4964
4965 Argument 1 -- The element of the structure the offset refers to.
4966 Argument 2 -- A DECL which describes the structure (the entire structure,
4967         not the element) the offset is an offset into.
4968 Returns -- The OFFSET.
4969
4970 Example:  <SET O <OFFSET 1 '<CHANNEL FIX>>>
4971           %<OFFSET 1 '<CHANNEL FIX>>
4972
4973 \f
4974 ON:       Create and turn on an interrupt handler
4975
4976 Object-type:  SUBR
4977
4978 Category:  INTERRUPT
4979
4980 Reference:  OFF, EVENT, HANDLER
4981
4982      ON is equivalent to a call to EVENT followed by a call to HANDLER.
4983 It causes an interrupt handler to be created and added to the list of
4984 handlers for a given interrupt.
4985
4986                 <ON "CLOCK" ,FOO 1 ,P>
4987
4988 is equivalent to
4989
4990                 <HANDLER <EVENT "CLOCK" 1> ,FOO ,P>
4991
4992      In the case of "CHAR" or "READ"/"WRITE", the channel or
4993 locative is the last argument.  In this case the process argument may
4994 be zero and is equivalent to no process being given.
4995
4996 Argument:
4997
4998   Template:  #DECL ("VALUE" HANDLER <OR STRING ATOM> APPLICABLE FIX "OPTIONAL"
4999                     <OR FIX PROCESS> <OR CHANNEL LOCATIVE>)
5000
5001 Argument 1 -- The name of the interrupt.  Note that if it is not one
5002         of the existing interrupts in the INTERRUPTS OBLIST, no ERROR,
5003         the interrupt is assumed to be a software one!
5004 Argument 2 -- An APPLICABLE, to be called with the appropriate number
5005         of arguments when the interrupt occurs.
5006 Argument 3 -- The priority of the interrupt.
5007 (Optional)
5008 Argument 4 -- the PROCESS in which to run the interrupt, 0 means the
5009         running one.
5010 Argument 5 -- If a "CHAR" interrupt, the CHANNEL.
5011         If a "READ" or "WRITE" interrupt, the LOCATIVE.
5012 Returns -- The HANDLER for the interrupt.
5013
5014 Example:  <ON "CLOCK" <FUNCTION () <PRINC " TICK ">> 1>
5015 \f
5016 OPEN-NR:  Create and open an I/O channel without changing file's reference date
5017
5018 Object-type:  SUBR
5019
5020 Category:  I/O
5021
5022 Reference:  OPEN
5023
5024         OPEN-NR is the same as OPEN (q.v.), except that the date of last
5025 reference of the opened file is not changed.
5026
5027 Argument:
5028
5029   Template:  #DECL ("VALUE" <OR CHANNEL <FALSE STRING STRING FIX>>
5030                     "OPTIONAL" STRING "TUPLE" TUPLE)
5031
5032 (Optional)
5033 Argument 1 -- mode
5034 Tuple of arguments -- 'file specification'
5035 Returns -- channel or false giving reason for failure & filename
5036
5037 Example:  <OPEN-NR "READ" "OLD FILE">
5038 so it will be reaped sooner
5039 \f
5040 OPEN:     Create and open an I/O channel
5041
5042 Object-type:  SUBR
5043
5044 Category:  I/O
5045
5046 Reference:  CHANNEL, RESET
5047
5048         OPEN creates a channel for subsequent input or output.
5049 All arguments are optional.  The first arg is the mode for the channel,
5050 a string from the list ("READ" "PRINT" "READB" "PRINTB" "PRINTO"
5051 "DISPLAY"), default "READ".  The other arguments specify the file
5052 or other 'external storage medium' involved.  These can be:
5053    . a string giving the complete file name
5054    . several strings giving name1, name2, device, and directory
5055    . the string "INT:" and a function, a source or sink for characters
5056    . two fixes, the string "NET", and two more fixes
5057 Omitted parts of the file specification follow these defaults:
5058    <VALUE NM1>, if any, else "INPUT"
5059    <VALUE NM2>, if any, else ">"
5060    <VALUE DEV>, if any, else "DSK"
5061    <VALUE SNM>, if any, else the 'working directory'
5062 For more details, see the manual, SYS.11.01.
5063
5064 Argument:
5065
5066   Template:  #DECL ("VALUE" <OR CHANNEL <FALSE STRING STRING FIX>>
5067                     "OPTIONAL" STRING "TUPLE" TUPLE)
5068
5069 (Optional)
5070 Argument 1 -- mode
5071 Tuple of arguments -- 'file' specification
5072 Returns -- a channel or a false giving the reason for failure & filename
5073
5074 Example:  <OPEN "PRINT" "TPL:">
5075 Make a channel for line-printer output.
5076 \f
5077 OR:       Logical OR of its arguments.
5078
5079 Object-type:  FSUBR
5080
5081 Category:  PREDICATE, PROGRAM-CONTROL
5082
5083 Reference:  COND, AND, OR?
5084
5085      OR is an FSUBR that evaluates its arguments, one by one, until
5086 either one of them returns a non-FALSE or it runs out of arguments.
5087      The fact that it is an FSUBR means that it can be used as a
5088 miniature COND.  A construct of the form <OR preconditions thing> will
5089 allow 'thing' to be executed only if 'preconditions' is false.  In
5090 combination with AND, fairly powerful constructs can be generated.
5091      OR takes any number of arguments, returning either the result of
5092 its last evaluation (#FALSE () if no arguments were given) or the
5093 non-FALSE that caused it to complete.
5094
5095 Argument:
5096
5097   Template:  #DECL ("VALUE" <OR FALSE ANY> "ARGS" LIST)
5098
5099 List of arguments -- ANY evalable objects.
5100 Returns -- Terminating non-FALSE or FALSE if all elements were FALSE.
5101
5102 Example:  <OR <LOOKUP "FOO" <ROOT>> <INSERT "FOO" <ROOT>>>
5103
5104 This construct only attempts to insert FOO in the ROOT if it is not
5105 already there, avoiding the possibility of an ERROR.
5106 \f
5107 OR?:      Logical OR of its arguments, evaluated at call time
5108
5109 Object-type:  SUBR
5110
5111 Category:  PREDICATE, PROGRAM-CONTROL
5112
5113 Reference:  AND?, OR, MAPF, MAPR
5114
5115      OR is a SUBR that looks at its arguments, one by one, until
5116 either one of them is a non-FALSE or it runs out of arguments.
5117      The fact that it is a SUBR means that it can be used as a
5118 first argument to MAPF or MAPR.
5119      OR takes any number of arguments, returning either
5120 its last argument (#FALSE () if no arguments were given) or the
5121 non-FALSE that caused it to complete.
5122
5123 Argument:
5124
5125   Template:  #DECL ("VALUE" <OR FALSE ANY> "TUPLE" TUPLE)
5126
5127 Tuple of arguments -- ANY objects.
5128 Returns -- Terminating non-FALSE or FALSE if all elements were FALSE.
5129
5130 Example:  <MAPF ,OR? <FUNCTION (T) <G? .T 0>> .VECTOR>
5131 Is any element of VECTOR positive?
5132 \f
5133 ORB:      Bitwise logical OR
5134
5135 Object-type:  SUBR
5136
5137 Category:  ARITHMETIC, BIT-TWIDDLING
5138
5139 Reference:  EQVB, XORB, ANDB
5140
5141      ORB takes any number of objects of Primtype WORD, and returns
5142 a WORD containing the bitwise logical OR of the arguments.
5143
5144 Argument:
5145
5146   Template:  #DECL ("VALUE" WORD
5147                     "TUPLE" <TUPLE [REST <PRIMTYPE WORD>]>)
5148
5149 Tuple of arguments -- Objects of primtype WORD to be ORed together.
5150 Returns -- A WORD containing the bitwise OR of the arguments.
5151
5152 Example:  <ORB #WORD *000000000001*
5153                #WORD *000000000001*
5154                #WORD *000000042260*>
5155           #WORD *000000042261*
5156 Primarily useful for getting fingers directly in the bits.
5157 \f
5158 OVERFLOW: Enable or disable overflow error
5159
5160 Object-type:  SUBR
5161
5162 Category:  ARITHMETIC
5163
5164 Reference:  +, -, *, /
5165
5166 OVERFLOW disables or enables -- if its argument is a FALSE or not,
5167 respectively -- overflow and underflow errors caused by arithmetic
5168 SUBRs.  Initially these errors are enabled.
5169
5170 Argument:
5171
5172   Template:  #DECL ("VALUE" <OR 'T '#FALSE ()>
5173                     "OPTIONAL" <OR ANY FALSE>)
5174
5175 (Optional)
5176 Argument 1 -- whether or not to enable over/underflow errors
5177 Returns -- the previous state, initially true, or current state if no arg
5178
5179 Example:  <OVERFLOW T>
5180 the initial state
5181 \f
5182 PARSE:    Parse a string into a MUDDLE object
5183
5184 Object-type:  SUBR
5185
5186 Category:  DATA-HANDLING
5187
5188 Reference:  UNPARSE, LPARSE
5189
5190      Parse a string into a MUDDLE object, just like reading from a
5191 string instead of a channel.
5192      PARSE takes from 0 to 5 arguments.  If parse is given no arguments,
5193 it returns the first item parsed from the local value of the string
5194 PARSE-STRING, and additionally, sets PARSE-STRING to the string having
5195 those characters which were parsed rested off.  If parse is given a
5196 string to parse, the atom, PARSE-STRING, is rebound to the string within
5197 that call.  If the parse table argument is given to PARSE, the value of
5198 PARSE-TABLE is rebound to it within that call to PARSE.  Finally, PARSE
5199 takes a look ahead character, which is treated as if it were logically
5200 concatenated to the front of the string being parsed.  The full calling
5201 sequence of PARSE is:
5202
5203    <PARSE string radixfornumberconversion oblistorlistofoblists
5204            parsetable lookaheadchar> 
5205
5206
5207 Argument:
5208
5209   Template:  #DECL ("VALUE" ANY "OPTIONAL" STRING
5210                     FIX <OR OBLIST
5211                             <LIST [REST <OR OBLIST 'DEFAULT>]>>
5212                     VECTOR CHARACTER)
5213
5214 (Optional)
5215 Argument 1 -- STRING to parse, if not given, LVAL of PARSE-STRING.
5216 Argument 2 -- FIX, radix for number conversion.
5217 Argument 3 -- An OBLIST or LIST of OBLISTs.
5218 Argument 4 -- A parse-table.
5219 Argument 5 -- A prefix character.
5220 Returns -- A MUDDLE object.
5221
5222 Example:  <PARSE "<+ 1 2>">
5223 Returns the FORM <+ 1 2>.
5224 \f
5225 PCODE:    Create pointer to pure RSUBR code
5226
5227 Object-type:  SUBR
5228
5229 Category:  UTILITY
5230
5231         PCODE returns a pure code vector for an RSUBR, given a name
5232 in the internal table of pure RSUBRs and the offset in the block of
5233 code where the RSUBR entry point is.  It is most often seen when
5234 a pure code vector is output, as %<PCODE "&" &>.
5235
5236 Argument:
5237
5238   Template:  #DECL ("VALUE" PCODE STRING FIX)
5239
5240 Argument 1 -- name in pure-RSUBR table
5241 Argument 2 -- offset in the code
5242 Returns -- a pure code vector
5243
5244 Example:  <PCODE "PPRINT" 0>
5245 Calls like this fill FBIN files.
5246 \f
5247 PNAME:    Create a distinct STRING which is the name of an ATOM
5248
5249 Object-type:  SUBR
5250
5251 Category:  IDENTIFIER
5252
5253 Reference:  ATOM, INSERT, SPNAME
5254
5255      PNAME takes as argument an ATOM, and returns the STRING which
5256 is the PNAME (printing name) of that ATOM.  This name does not include
5257 any oblist trailers or the backslashes that are sometimes printed out
5258 for the convenience of the reader.  Several other SUBRs, notably
5259 INSERT, LOOKUP, and ATOM, use the pname of atoms as arguments.
5260      PRINC of the PNAME of an ATOM is one guaranteed way of printing
5261 an ATOM-name without trailers, backslashes, or quotes.
5262
5263 Argument:
5264
5265   Template:  #DECL ("VALUE" STRING ATOM)
5266
5267 Argument 1 -- An ATOM.
5268 Returns -- A STRING which contains the atom's pname.
5269
5270 Example:  <PNAME \ \ \ !-FOO!-BAR>
5271    
5272 Just three spaces, no backslashes, no trailers.
5273 \f
5274 PRIMTYPE-C: Get a primtype code for an object
5275
5276 Object-type:  SUBR
5277
5278 Category:  TYPE-DEFINITION
5279
5280 Reference:  PRIMTYPE TYPE-C
5281
5282    PRIMTYPE-C returns the 'storage type code' for an object.
5283 This gives no more info than PRIMTYPE (q.v.), except for TEMPLATEs:
5284 each TYPE of TEMPLATE has a different PRIMTYPE-C.
5285
5286 Argument:
5287
5288   Template:  #DECL ("VALUE" PRIMTYPE-C ATOM)
5289       
5290 Argument 1 -- the type to get a code for
5291 Returns -- a 'storage type code'
5292
5293 Example:  <PRIMTYPE-C <NEWTYPE FOO TEMPLATE>>
5294 returns a 'storage type code' for my template
5295 \f
5296 PRIMTYPE: Return the primitive type of an object
5297
5298 Object-type:  SUBR
5299
5300 Category:  TYPE
5301
5302 Reference:  UTYPE, TYPE, TYPEPRIM
5303
5304      PRIMTYPE is applied to any MUDDLE object to return an ATOM which
5305 is the name of the PRIMITIVE type of that object.  TYPE, which is
5306 similar, returns the type of the object given.  TYPEPRIM returns the
5307 primitive type given the name of the type.
5308
5309 Argument:
5310
5311   Template:  #DECL ("VALUE" ATOM ANY)
5312
5313 Argument 1 -- Any MUDDLE object.
5314 Returns -- ATOM, the name of the primitive type of the argument.
5315
5316 Example:  <TYPE 1>
5317           FIX
5318           <PRIMTYPE 1>
5319           WORD
5320
5321 PRIMTYPE will obviously return the same result for a larger class of
5322 objects than will TYPE.
5323 \f
5324 PRIN1:    Print an object on an I/O channel
5325
5326 Object-type:  SUBR
5327
5328 Category:  I/O
5329
5330 Reference:  PRINT
5331
5332 PRIN1 is exactly like PRINT (q.v.) except that it omits the new-line
5333 before and the space afterward.
5334
5335 Argument:
5336
5337   Template:  #DECL ("VALUE" ANY ANY "OPTIONAL" CHANNEL)
5338
5339 Argument 1 -- the object
5340 (Optional)
5341 Argument 2 -- the output channel, default .OUTCHAN
5342 Returns -- the object
5343
5344 Example:  <PRIN1 .X>
5345 boring example, sorry
5346 \f
5347 PRINC:    Print an object on an I/O channel without indicators
5348
5349 Object-type:  SUBR
5350
5351 Category:  I/O
5352
5353 Reference:  PRIN1, PRINT
5354
5355 PRINC is exactly like PRIN1 (q.v.) except that it omits "s around
5356 strings, !\s before characters, and \s and trailers for atoms.
5357
5358 Argument:
5359
5360   Template:  #DECL ("VALUE" ANY ANY "OPTIONAL" CHANNEL)
5361
5362 Argument 1 -- the object
5363 (Optional)
5364 Argument 2 -- the output channel, default .OUTCHAN
5365 Returns -- the object
5366
5367 Example:  <PROG ()
5368                 <TERPRI>
5369                 <PRINC "LISTENING-AT-LEVEL MEZZANINE PROCESS CHEESE">
5370                 <TERPRI>>
5371 Amaze your friends!
5372 \f
5373 PRINT:    Print an object on an I/O channel on a new line
5374
5375 Object-type:  SUBR
5376
5377 Category:  I/O
5378
5379 PRINT outputs the character representation (unparsing) of its first
5380 argument, preceded by carriage-return/line-feed and succeeded by a space.
5381
5382 Argument:
5383
5384   Template:  #DECL ("VALUE" ANY ANY "OPTIONAL" CHANNEL)
5385
5386 Argument 1 -- the object
5387 (Optional)
5388 Argument 2 -- the output channel, default .OUTCHAN
5389 Returns -- the object
5390
5391 Example:  <PRINT .X>
5392 not a very wonderful example
5393 \f
5394 PRINTB:   Write binary words on an I/O channel
5395
5396 Object-type:  SUBR
5397
5398 Category:  I/O
5399
5400 PRINTB writes the entire contents of its first argument into a given
5401 channel, as 36-bit binary words.
5402
5403 Argument:
5404
5405   Template:  #DECL ("VALUE" <OR UVECTOR STORAGE>
5406                     <<OR UVECTOR STORAGE> [REST <PRIMTYPE WORD>]> CHANNEL)
5407
5408 Argument 1 -- the buffer whose contents to write
5409 Argument 2 -- the output channel, open in PRINTB or PRINTO mode
5410 Returns -- arg1
5411
5412 Example:  <PRINTB .BUFFER .PRINTB-CHNL>
5413 Can't use a console channel.
5414 \f
5415 PRINTSTRING: Write contents of string on an I/O channel
5416
5417 Object-type:  SUBR
5418
5419 Category:  I/O
5420
5421 PRINTSTRING writes the entire contents or initial characters of a
5422 string on a given channel.  The output appears identical to that
5423 produced by PRINC.
5424
5425 Argument:
5426
5427   Template:  #DECL ("VALUE" FIX STRING "OPTIONAL" CHANNEL FIX)
5428
5429 Argument 1 -- the string to write out
5430 (Optional)
5431 Argument 2 -- the output channel, default .OUTCHAN
5432 Argument 3 -- number of characters to output, default all
5433 Returns -- number of characters output
5434
5435 Example:  <READSTRING .TRASH
5436                       .STY-IN
5437                       <PRINTSTRING "HI THERE!" .STY-OUT>>
5438 Suck out the echoed characters on your pseudo-console.
5439 \f
5440 PRINTTYPE: Change or examine the way a TYPE is PRINTed
5441
5442 Object-type:  SUBR
5443
5444 Category:  TYPE-MANIPULATION, PROGRAM-CONTROL, I/O
5445
5446 Reference:  PRINT
5447
5448      Changes the way a specific type is PRINTed, by either mapping
5449 it into another type, or giving an explicit method via an APPLICABLE.
5450      If a type is given, the type being changed will be PRINTed in the
5451 same manner as that type.  Note that in this case the two types must
5452 be of the same PRIMTYPE or else ERROR.
5453      If an APPLICABLE is given, it should take one argument, which
5454 will be the object being PRINTed.  If ,PRINT is given, the type will
5455 receive no special treatment in printing.
5456      If no second argument is given, PRINTTYPE returns the last arg
5457 given it for that TYPE, or else #FALSE () if the type is receiving no
5458 special treatment in printing.
5459
5460 Argument:
5461
5462   Template:  #DECL ("VALUE" <OR ATOM APPLICABLE FALSE> ATOM "OPTIONAL"
5463                     <OR ATOM APPLICABLE>)
5464
5465 Argument 1 -- The type whose PRINTTYPE to change or examine.
5466 (Optional)
5467 Argument 2 -- A TYPE (which means 'Print like this type'), or an
5468         APPLICABLE (meaning 'use this when you PRINT this type').
5469 Returns -- The TYPE which was changed or, if no arg 2, the way the
5470         TYPE is being printed.
5471
5472 Example:  <PRINTTYPE FORM LIST>
5473 Combine with example for EVALTYPE and make MUDDLE look like LISP.
5474           <PRINTTYPE FORM <FUNCTION (X) <PRINC "FOO">>>
5475 Confuse your friends.
5476 \f
5477 PROCESS:  Create a new PROCESS
5478
5479 Object-type:  SUBR
5480
5481 Category:  TYPE-MANIPULATION, PROCESS-CONTROL
5482
5483 Reference:  RESUME, STATE
5484
5485      PROCESS creates a new PROCESS with a given start up function.
5486 This must be an APPLICABLE of one argument, which must be evaled.
5487 If the starter of a PROCESS ever returns a value, that PROCESS is DEAD.
5488      Note that creating a PROCESS will often cause a GC.
5489
5490 Argument:
5491
5492   Template:  #DECL ("VALUE" PROCESS APPLICABLE)
5493
5494 Argument 1 -- An APPLICABLE which takes a single evaluated argument.
5495 Returns -- A new PROCESS.
5496
5497 Example:
5498   <SET P <PROCESS ,LISTEN>>
5499 Creates a process which is a read-eval-print loop like <MAIN>.
5500   <STATE .P>
5501   RUNABLE
5502 Means P has never run.
5503   <RESUME T .P>
5504 Starts it.
5505
5506 To treat a process like a simple function:
5507   <RESUME T <PROCESS <FUNCTION (X) .X>>>
5508 Starts it, returns the result of applying arg1 (T) to the function,
5509 and then dies.
5510 \f
5511 PROG:     Execute sequential expressions
5512
5513 Object-type:  FSUBR
5514
5515 Category:  PROGRAM-CONTROL
5516
5517 Reference:  REPEAT
5518
5519      This FSUBR is used to bind variables and sequentially execute
5520 MUDDLE expressions and perform appropriate GOs, RETURNs, and AGAINs.
5521      If the first argument to PROG is an atom, it is bound to the
5522 Activation of the PROG.
5523      Otherwise the next object must be the argument list of the PROG.
5524 It contains either Atoms or Lists of an Atom and a MUDDLE expression.
5525 Each single Atom in the argument list is Bound but not Assigned.  Each
5526 'listified' Atom is Bound and Assigned to the evaluation of the MUDDLE
5527 expression which appears with it.
5528      If the next argument to the PROG is of type DECL, it is used as
5529 the declaration for the variables of the PROG.
5530      The remaining arguments, at least one must exist, constitute the
5531 body of the PROG.  They are executed in sequence with the value of the
5532 last being the value for the entire PROG, unless a RETURN from the
5533 activation of the PROG (explicit or with only one argument) is done.
5534
5535 Argument:
5536
5537   Template:  #DECL ("VALUE" ANY "ARGS" <LIST ATOM LIST DECL ANY>)
5538
5539 Optional argument 1 -- An ATOM, to bind the activation of the PROG to.
5540 Argument 2 -- A parameter LIST.
5541 Optional argument 3 -- The DECL of the PROG.
5542 Remainder of arguments -- At least one object, to be sequentially evaled.
5543 Returns -- The last thing evaled in the PROG, or the argument to a
5544         RETURN within the PROG.
5545
5546 Example:  <PROG ((C <OPEN "READ" "FOO BAR">))
5547                 <COND (.C
5548                        <FOO>
5549                        <CLOSE .C>)>>
5550 This will FOO only if the file FOO BAR exists.
5551 \f
5552 PURIFY:   Purify objects everywhere
5553
5554 Object-type:  SUBR
5555
5556 Category:  UTILITY
5557
5558 Reference:  SUBSTITUTE, FSAVE, RESTORE
5559
5560         PURIFY causes a mini-GC, like SUBSTITUTE, resulting in its args
5561 becoming pure and sharable, and ignored by the garbage collector.
5562 No arg can live on the stack or be of primtype process, locd, or
5563 asoc.  Sharing between jobs/forks actually occurs after FSAVE/RESTORE.
5564
5565 Argument:
5566
5567   Template:  #DECL ("VALUE" ANY "TUPLE" TUPLE)
5568
5569 Tuple of Arguments -- the objects to be purified, not RSUBRs
5570 Returns -- its last arg, now pure
5571
5572 Example:  <PURIFY .GROUP>
5573 OK if no RSUBRs in the group
5574 \f
5575 PUT-DECL: Give a value a DECL or change the existing one
5576
5577 Object-type:  SUBR
5578
5579 Category:  DATA-HANDLING
5580
5581 Reference:  GET-DECL
5582
5583      PUT-DECL gives a DECL to a global or local value, or changes
5584 the existing DECL.  It takes a locative to the value and a DECL, which
5585 cannot be FALSE or MANIFEST.  It modifies the DECL of the value to
5586 be that second argument.
5587      Note that the new DECL must correspond with the type of the
5588 value, if <DECL-CHECK> is T.  For example, if the value is a FIX, you
5589 cannot change the DECL to be VECTOR, without first changing the value.
5590
5591      PUT-DECL may also be used to make a new OFFSET from an old one, given
5592 a new DECL part for the OFFSET.
5593
5594 Argument:
5595
5596   Template:  #DECL ("VALUE" LOCD <OR LOCD OFFSET> <OR ATOM <FORM 'QUOTE FORM>>)
5597
5598 Argument 1 -- A locative to a value of an ATOM, or an OFFSET.
5599 Argument 2 -- A new DECL for that value, or a new OFFSET.
5600 Returns -- Argument 1.
5601
5602 Example:  <SETG FOO 1>
5603           1
5604           <GDECL (FOO) <PRIMTYPE WORD>>
5605           T
5606           <GET-DECL <GLOC FOO>>
5607           <PRIMTYPE WORD>
5608           <PUT-DECL <GLOC FOO> FIX>
5609 returns locative here
5610           <PUT-DECL <GLOC FOO> VECTOR>
5611 here ERROR, type mismatch, as GVAL of FOO is FIX.
5612
5613           <PUT-DECL <SET X <OFFSET 1 '<FOO FIX>>> '<CHANNEL FIX>>
5614           %<OFFSET 1 '<CHANNEL FIX>>
5615 Note that this is a new OFFSET:
5616           .X
5617           %<OFFSET 1 '<FOO FIX>>
5618
5619 \f
5620 PUT:      Change an element of a structure or make an association
5621
5622 Object-type:  SUBR
5623
5624 Category:  DATA-HANDLING, ASSOCIATION
5625
5626 Reference:  PUTPROP, GET
5627
5628      PUT associates a property with an item or (as with GET) if arg 1
5629 is structured and arg 2 is fix, insert the third arg as the fix'th
5630 element.
5631      PUT is thus exactly like PUTPROP if the first argument is not
5632 structured or the second not FIX.  If used as PUTPROP, and no third
5633 argument is given, removes any association between ARG 1 and ARG 2.
5634      Returns the first argument.
5635
5636 Argument:
5637
5638   Template:  #DECL ("VALUE" ANY ANY ANY "OPTIONAL" ANY)
5639
5640 Argument 1 -- ANY, the object with the association, or the structure
5641         whose Nth element to replace.
5642 Argument 2 -- ANY, the indicator under which the association is
5643         stored, if fix and first arg a structure, clobber the fix'th
5644         element with the value instead.
5645 (Optional)
5646 Argument 3 -- ANY, the value to be associated, if none, the previous
5647         association is removed.
5648 Returns -- The result is the first argument.
5649
5650 Example:  <PUT FOO 1 BAR>
5651 Like PUTPROP.
5652           <PUT .FOO 1 BAR>
5653 If .FOO is structured, clobber its first element.
5654 \f
5655 PUTBITS:  Change part of a WORD
5656
5657 Object-type:  SUBR
5658
5659 Category:  BIT-TWIDDLING
5660
5661 Reference:  BITS, GETBITS
5662
5663      PUTBITS changes part of a PRIMTYPE WORD, as described by a BITS
5664 and a PRIMTYPE WORD.  It takes the rightmost bits of the third
5665 argument, which defaults to 0, and clobbers the bit positions
5666 indicated by the BITS in the first argument.
5667      It is functionally equivalent to the PDP-10 Deposit Byte (DPB)
5668 instruction.
5669
5670 Argument:
5671
5672   Template:  #DECL ("VALUE" <PRIMTYPE WORD> <PRIMTYPE WORD> BITS
5673                     "OPTIONAL" <PRIMTYPE WORD>)
5674
5675 Argument 1 -- A PRIMTYPE WORD, the destination of the bits.
5676 Argument 2 -- A BITS, describes how many bits to move and where in the
5677         output word to put them.
5678 (Optional)
5679 Argument 3 -- A PRIMTYPE WORD, the source of the bits to move, default 0.
5680 Returns -- The new version of argument 1.  Arg 1 itself is not changed.
5681
5682 Example:  <PUTBITS -1 <BITS 6 3>>
5683           -505
5684 Args need not be of type WORD.
5685 \f
5686 PUTPROP:  Change or create an association
5687
5688 Object-type:  SUBR
5689
5690 Category:  DATA-HANDLING, ASSOCIATION
5691
5692 Reference:  PUT, GET
5693
5694      PUTPROP associates a property with an item under a given
5695 indicator.  If no property (or value) is given, any association of the
5696 item and indicator is removed.   Note that if PUT's first argument is
5697 not structured and its second argument is not FIX, it is identical to
5698 PUTPROP.
5699      Returns the first argument.
5700
5701 Argument:
5702
5703   Template:  #DECL ("VALUE" ANY ANY ANY "OPTIONAL" ANY)
5704
5705 Argument 1 -- ANY, the object with the association
5706 Argument 2 -- ANY, the indicator under which the association is to be
5707         stored.
5708 (Optional)
5709 Argument 3 -- ANY, the value to be associated, if none, the previous
5710         association is removed.
5711 Returns -- The result is the first argument.
5712
5713 Example:  <PUTPROP .FOO 1 BAR>
5714 Makes association.
5715           <PUT .FOO 1 BAR>
5716 If .FOO is structured, clobber its first element, else make association.
5717 \f
5718 PUTREST:  Make REST of a LIST a given LIST
5719
5720 Object-type:  SUBR
5721
5722 Category:  DATA-HANDLING
5723
5724 Reference:  LIST
5725
5726      PUTREST replaces the rest of a list making arg2 be REST of arg1.
5727 Notice that this does not copy the lists, so it can be used to produce
5728 circular lists.
5729
5730 Argument:
5731
5732   Template:  #DECL ("VALUE" <PRIMTYPE LIST>
5733                     <PRIMTYPE LIST> <PRIMTYPE LIST>)
5734
5735 Argument 1 -- A LIST, rest of which will be replaced by Argument 2.
5736 Argument 2 -- A LIST, which will become the new REST of Argument 1.
5737 Returns -- The new LIST.
5738
5739 Example:  <PUTREST <REST <SET X (1 2 3)> 2> (4 5 6)>
5740           (3 4 5 6)
5741 .X will now be (1 2 3 4 5 6).
5742           <PUTREST <SET CIRCULAR (0)> .CIRCULAR>
5743 Create a circular LIST of one element.
5744 \f
5745 QUIT:     Kill a MUDDLE
5746
5747 Object-type:  SUBR
5748
5749 Category:  SYSTEM
5750
5751 Reference:  LOGOUT, VALRET
5752
5753      Causes a MUDDLE to VALRET the string ':KILL<cr>' to its
5754 superior.  This will cause the superior to kill the MUDDLE job.
5755
5756 Argument:
5757
5758   Template:  #DECL ()
5759
5760 Never returns.
5761
5762 Example:  <QUIT>
5763 Only possible example.
5764 \f
5765 QUITTER:  Default character interrupt SUBR
5766
5767 Object-type:  SUBR
5768
5769 Category:  INTERRUPT
5770
5771 Reference:  ON, OFF
5772
5773      QUITTER is not normally called by user programs.  It is the
5774 default character interrupt SUBR that handles ^S and ^G
5775
5776 Argument:
5777
5778   Template:  #DECL ("VALUE" ANY CHARACTER CHANNEL)
5779
5780 Argument 1 -- The CHARACTER typed.
5781 Argument 2 -- The CHANNEL which produced the interrupt.
5782 Returns -- The CHARACTER typed.
5783
5784 Example:  For the best example, type ^G and then <FRAMES> to a MUDDLE.
5785 \f
5786 QUOTE:    Return its first argument unEVALed.
5787
5788 Object-type:  FSUBR
5789
5790 Category:  UTILITY
5791
5792 Reference:  EVAL
5793
5794 The QUOTE Fsubr takes unEVALuated arguments and returns the first.
5795 It is the way to circumvent the normal EVALuation mechanism.
5796 Note that 'object is an abbreviation for <QUOTE object>.
5797
5798 Argument:
5799
5800   Template:  #DECL ("VALUE" ANY "ARGS" LIST)
5801
5802 Arguments -- ANY objects; the first will be returned untouched by QUOTE.
5803 Returns -- Its first argument, untouched by interpreted hands.
5804
5805 Example:  `
5806           [CHRIS
5807            BRUCE
5808            NEAL
5809            DAVE
5810            HOWARD]
5811
5812 This will cause the Vector to be returned unEVALuated and therefore
5813  without the overhead of copying.
5814           '(<PUSH TP* (TB)>
5815             <PUSH TP* (TB) 1>
5816             <MCALL 1 PRINC>)
5817 This will return a list of Forms.
5818 \f
5819 RANDOM:   Generate a random FIX
5820
5821 Object-type:  SUBR
5822
5823 Category:  ARITHMETIC
5824
5825      RANDOM generates a random FIX.  If the seeds of the MUDDLE
5826 random number generator are not touched, repeated invocations of
5827 RANDOM will return the exact same sequence of numbers.  This is for
5828 convenience in debugging.  'Debugged' code should pass the first and
5829 second optional arguments to RANDOM, which change the two seeds it
5830 uses to generate its numbers.   Popular choices of new seeds are the
5831 numbers returned by TIME and the contents of various UVECTOR buffers.
5832
5833 Argument:
5834
5835   Template:  #DECL ("VALUE" FIX "OPTIONAL" FIX FIX)
5836
5837 (Optional)
5838 Arguments 1 and 2 -- New seed settings for the random number generator.
5839 Returns -- A random FIX.
5840
5841 Example:  <MOD <RANDOM> 30>
5842 How to generate a random number between 0 and N.
5843 \f
5844 READ:     Read one object from an I/O channel
5845
5846 Object-type:  SUBR
5847
5848 Category:  I/O
5849
5850 READ returns the entire object whose character representation is next
5851 in the input stream.  If there is a comment on the object, it is PUT
5852 on the channel used with indicator COMMENT.  
5853
5854 Argument:
5855
5856   Template:  #DECL ("VALUE" ANY "OPTIONAL" CHANNEL ANY
5857                     <OR OBLIST <LIST [REST <OR OBLIST 'DEFAULT>]>>
5858                     VECTOR)
5859
5860 (Optional)
5861 Argument 1 -- input channel, default .INCHAN
5862 Argument 2 -- object to eval and return at end of file, default
5863         <ERROR END-OF-FILE!-ERRORS>
5864 Argument 3 -- oblist or list therof for looking up atoms, default .OBLIST
5865 Argument 4 -- READ-TABLE giving special characters, default .READ-TABLE
5866 Returns -- the object read
5867
5868 Example:  <SET NEWOBJ <READ>>
5869 Calls like this make you CALICO-incompatible.
5870 \f
5871 READB:    Read binary words from an I/O channel
5872
5873 Object-type:  SUBR
5874
5875 Category:  I/O
5876
5877         READB fills a buffer with 36-bit binary words and returns the
5878 number of words read.  If the end of file is reached, this number will
5879 be less than the size of the buffer.  If another READB is attempted,
5880 the end-of-file arg will be evaled and returned.
5881
5882 Argument:
5883
5884   Template:  #DECL ("VALUE" FIX
5885                     <<OR UVECTOR STORAGE> [REST <PRIMTYPE WORD>]> CHANNEL
5886                     "OPTIONAL" ANY)
5887
5888 Argument 1 -- buffer to fill
5889 Argument 2 -- "READB" channel
5890 (Optional)
5891 Argument 3 -- object to eval and return at end of file
5892 Returns -- number of binary words read
5893
5894 Example:  <READB <OPEN "READB" "DSK:.FILE. (DIR)">
5895                  <IUVECTOR 1024 '0>>
5896 Get your file directory in binary form.
5897 \f
5898 READCHR:  Read one character from an I/O channel
5899
5900 Object-type:  SUBR
5901
5902 Category:  I/O
5903
5904 Reference:  TYI
5905
5906         READCHR returns the next character in the input stream from a
5907 given channel.  Successive calls return successive characters.  If the
5908 channel is open to a console, receipt of a character is held off until
5909 an ESC is typed.  If it is open to a pseudo-console in "READ" mode
5910 and no input is available, READCHR returns -1.
5911
5912 Argument:
5913
5914   Template:  #DECL ("VALUE" <OR CHARACTER FIX> "OPTIONAL" CHANNEL
5915                     ANY)
5916
5917 (Optional)
5918 Argument 1 -- the channel to read from
5919 Argument 2 -- object to eval and return at end of file
5920 Returns -- the character read (-1 if empty STY device)
5921
5922 Example:  <READCHR>
5923           !\\e
5924 If called alone, you get the ESC.
5925 \f
5926 READSTRING: Read into a string from an I/O channel
5927
5928 Object-type:  SUBR
5929
5930 Category:  I/O
5931
5932 Reference:  READB
5933
5934 READSTRING is the string analog to READB (q.v.).  It fills a string
5935 buffer with characters from a channel, returning the number of characters
5936 input.  One argument tells when to stop reading: after a certain number
5937 of characters or upon reading one of a set of characters.
5938
5939 Argument:
5940
5941   Template:  #DECL ("VALUE" FIX STRING "OPTIONAL" CHANNEL <OR FIX STRING>
5942                     ANY)
5943
5944 Argument 1 -- buffer to read into
5945 (Optional)
5946 Argument 2 -- channel to read from, default .INCHAN
5947 Argument 3 -- number of chars to read or char to stop reading on
5948 Argument 4 -- object to eval and return at end of file
5949 Returns -- number of characters read
5950
5951 Example:  <READSTRING " ">
5952           1
5953 You get the ESC if called alone.
5954 \f
5955 REALTIMER: Set interval between Real-time interrupts
5956
5957 Object-type:  SUBR
5958
5959 Category:  INTERRUPT
5960
5961 Reference:  RUNTIMER
5962
5963      REALTIMER sets the interval (in seconds) between REALT (real-
5964 time) interrupts.  The MUDDLE will be interrupted each time this many
5965 seconds elapse.
5966
5967 Argument:
5968
5969   Template:  #DECL ("VALUE" <OR FIX FLOAT> <OR FIX FLOAT>)
5970
5971 Argument 1 -- Interval between Real-time interrupts (in seconds).
5972 Returns -- Argument 1.
5973
5974 Example:  <REALTIMER <* 10 60>>
5975 Interrupt every ten minutes.
5976 \f
5977 REMOVE:   Remove an ATOM from its OBLIST
5978
5979 Object-type:  SUBR
5980
5981 Category:  IDENTIFIER
5982
5983 Reference:  INSERT, LOOKUP
5984
5985     REMOVE is the opposite of INSERT.  It takes a single argument, an
5986 ATOM, and removes that ATOM from its OBLIST.  It can also take two
5987 arguments, a STRING and an OBLIST, and removes the ATOM of that PNAME
5988 from that OBLIST.  The ATOM, which now is on no OBLIST, and therefore
5989 has a trailer of !-#FALSE(), is returned. If the ATOM was originally
5990 on no OBLIST, or if the STRING names no ATOM on the OBLIST, REMOVE
5991 returns #FALSE ().
5992
5993 Argument:
5994
5995   Template:  #DECL ("VALUE" <OR ATOM FALSE> <OR ATOM STRING> "OPTIONAL"
5996                     OBLIST)
5997
5998 Argument 1 -- The ATOM to flush from its OBLIST, or a STRING.
5999 (Optional)
6000 Argument 2 -- If arg 1 was a STRING, this is the OBLIST to mung.
6001 Returns -- The now homeless ATOM.
6002
6003 Example:  <INSERT <REMOVE FOO> <ROOT>>
6004 You can move ATOMs from one OBLIST to another with REMOVE and INSERT.
6005 \f
6006 RENAME:   Rename or delete a disk file
6007
6008 Object-type:  SUBR
6009
6010 Category:  I/O
6011
6012         RENAME is for renaming and deleting files.  It takes three
6013 kinds of arguments:
6014    (a) two file names (one or more strings) separated by the atom TO,
6015    (b) one file name, or
6016    (c) a channel (output mode) and a file name.
6017 Omitted file-name parts use the OPEN defaults.  The action is, respectively,
6018    (a) rename the file named first to the second name,
6019    (b) delete the file, or
6020    (c) rename the file while open for writing.
6021
6022 Argument:
6023
6024   Template:  #DECL ("VALUE" <OR 'T <FALSE STRING FIX>>
6025                     "TUPLE" <TUPLE <OR STRING CHANNEL>>)
6026
6027 Tuple of arguments -- rename or delete action (see description)
6028 Returns -- whether it succeeded
6029
6030 Example:  <RENAME "FOO 3" TO "BAR">
6031           T
6032 Rename FOO 3 to BAR >.
6033           <RENAME "FOO FOO DSK:HARRY;">
6034           T
6035 Delete that file.
6036 \f
6037 REP:      Enter a READ-EVAL-PRINT loop
6038
6039 Object-type:  SUBR
6040
6041 Category:  SYSTEM
6042
6043 Reference:  LISTEN, ERRET, RETRY
6044
6045 REP causes an endless READ-EVAL-PRINT loop, which is left only by a
6046 non-local return.  It is the last thing that LISTEN does, unless there
6047 is a substitute <VALUE REP>.
6048
6049 Argument:
6050
6051   Template:  #DECL ("VALUE" ANY)
6052
6053 Returns -- argument to ERRET
6054
6055 Example:  <REP>
6056 no arguments
6057 \f
6058 REPEAT:   Execute repeatedly sequential expressions.
6059
6060 Object-type:  FSUBR
6061
6062 Category:  PROGRAM-CONTROL
6063
6064 Reference:  PROG, RETURN, GO, AGAIN
6065
6066     This FSUBR is used to bind varialbes and repeatedly and
6067 sequentially execute MUDDLE expressions and perform appropriate GOs,
6068 RETURNs, and AGAINs.
6069      If the first argument to REPEAT is an atom, it is bound to the
6070 Activation of the REPEAT.
6071      Otherwise the next object must be the argument list of the REPEAT.
6072 It contains either Atoms or Lists of an Atom and a MUDDLE expression.
6073 Each single Atom in the argument list is Bound but not Assigned.  Each
6074 'listified' Atom is Bound and Assigned to the evaluation of the MUDDLE
6075 expression which appears with it.
6076      If the next argument to the REPEAT is of type DECL, it is used as
6077 the declaration for the variables of the REPEAT.
6078      The remaining arguments, at least one must exist, constitutes the
6079 body of the REPEAT.  They are executed in sequence.  When the last has
6080 been evaluated, evaluation begins again with the first expression in
6081 the body.  Unless a RETURN or non-local AGAIN or GO is executed at
6082 some time by the body of the REPEAT, the REPEAT will never return.
6083
6084 Argument:
6085
6086   Template:  #DECL ("VALUE" ANY "ARGS" <LIST ATOM LIST DECL ANY>)
6087
6088 Optional argument 1 -- ATOM to which to bind the activation of the
6089         REPEAT.
6090 Argument 2 -- Parameter list of the REPEAT.
6091 Optional argument 3 -- DECL of the REPEAT.
6092 Tuple of arguments -- At least one evalable object.
6093 Returns -- the argument to a RETURN from the REPEAT's activation.
6094
6095 Example:  <REPEAT ((C ()))
6096                   <COND (<N==? <1 <SET C (<RANDOM> !.C)>> 69>)
6097                         (ELSE <RETURN .C>)>>
6098 This will create a LIST of random numbers until RANDOM returns 69.
6099 \f
6100 RESET:    Reopen a channel at its beginning
6101
6102 Object-type:  SUBR
6103
6104 Category:  I/O
6105
6106 Reference:  ACCESS, OPEN
6107
6108         RESETting a channel means:
6109 for input, empty all buffers and ACCESS the file (if any) to 0;
6110 for output, return to beginning of file, destroying all output if not
6111 "PRINTO".  If the channel is closed, it is first opened.  RESET on
6112 either console channel causes the interpreter to update device specs.
6113
6114 Argument:
6115
6116   Template:  #DECL ("VALUE" <OR CHANNEL <FALSE STRING STRING FIX>> CHANNEL)
6117
6118 Argument 1 -- the channel to reset
6119 Returns -- arg1 or a false if reopen failed
6120
6121 Example:  <RESET ,INCHAN>
6122 after detaching and moving to a different console
6123 \f
6124 REST:     Remove elements from the front of a structure
6125
6126 Object-type:  SUBR
6127
6128 Category:  DATA-HANDLING
6129
6130 Reference:  BACK, TOP
6131
6132      REST removes the first N elements from a structure, that is,
6133 moves N places down the structure.  N defaults to 1 if not given.
6134      For some structures, the effect of REST may be undone with BACK.
6135      Note that the result of REST is always CHTYPEd to its PRIMTYPE,
6136 thus FORMs become LISTs when RESTed, and so on.
6137
6138 Argument:
6139
6140   Template:  #DECL ("VALUE" STRUCTURED STRUCTURED "OPTIONAL" FIX)
6141
6142 Argument 1 -- A Structured object.
6143 (Optional)
6144 Argument 2 -- FIX, default 1.
6145 Returns -- The result is the structured object, CHTYPEd to its
6146          primtype.
6147
6148 Example:  <SET A <REST [1 2 3 4] 3>>
6149           [4]
6150           <SET B <BACK .A>>
6151           [3 4]
6152           <SET C <BACK .A 2>>
6153           [2 3 4]
6154           <SET D <TOP .A>>
6155           [1 2 3 4]
6156           <SET E <REST .D>>
6157           [2 3 4]
6158           <SET F <REST "XYZ">>
6159 YZ
6160
6161 The relationships between REST, BACK, and TOP are illustrated.
6162 Note that only REST can work on lists
6163 \f
6164 RESTORE:  Restore a previously SAVEd core image
6165
6166 Object-type:  SUBR
6167
6168 Category:  ENVIRONMENT
6169
6170 Reference:  SAVE, FSAVE
6171
6172      RESTORE replaces the entire current MUDDLE environment with one
6173 from a file generated by SAVE.  It is much faster than FLOAD for very
6174 large programs.  RESTORE does not return; the SAVE that originally
6175 created the file returns again with the string "RESTORED" as its
6176 value.
6177      All arguments are optional with a default file name of
6178
6179                  DSK:<-user's sname>-;MUDDLE SAVE
6180
6181      Note that RESTORE attempts to restore the state of all channels.
6182      If the SNAME of the MUDDLE doing the SAVE was "", the current
6183 SNAME will not be changed by the RESTORE.  This feature is useful
6184 if a SAVE file is to be used by more than one person.
6185
6186 Argument:
6187
6188   Template:  #DECL ("VALUE" STRING "OPTIONAL" STRING STRING STRING
6189                     STRING)
6190
6191 (Optional)
6192 Arguments -- Up to four STRINGs specifying the file name to RESTORE.
6193 Returns -- The STRING "RESTORED".
6194
6195 Example:  <RESTORE "MUDDLE;NCOMP">
6196 Restore the compiler.
6197 \f
6198 RESUME:   Resume running a PROCESS
6199
6200 Object-type:  SUBR
6201
6202 Category:  PROCESS-CONTROL
6203
6204 Reference:  RESUMER, PROCESS
6205
6206      RESUME starts a PROCESS running.  It takes something to return
6207 as the 'value' of the current PROCESS, and the PROCESS to resume.  If
6208 not given, the PROCESS to RESUME is defaulted to be the last PROCESS to
6209 RESUME the PROCESS doing the RESUME, if there was one.
6210       If the process that is doing the RESUME is ever itself RESUMEd,
6211 the first argument to that RESUME will be returned as its value.  In
6212 fact, a PROCESS may be treated in the simpler cases as a routine called
6213 by invoking RESUME, which returns the result as RESUME's value.
6214
6215 Argument:
6216
6217   Template:  #DECL ("VALUE" ANY ANY "OPTIONAL" PROCESS)
6218
6219 Argument 1 -- Something to be returned to the resumed process.
6220 (Optional)
6221 Argument 2 -- The PROCESS to resume, default <RESUMER> if there is one.
6222 Returns -- Whatever is passed to RESUME later in another PROCESS to
6223         RESUME this one.
6224
6225 Example:  <COND (<RESUMER> <RESUME T <RESUMER>>)>
6226 Resumer our RESUMER, if we have one.
6227 \f
6228 RESUMER:  Return the last PROCESS to RESUME a PROCESS
6229
6230 Object-type:  SUBR
6231
6232 Category:  PROCESS-CONTROL
6233
6234 Reference:  RESUME
6235
6236      RESUMER takes an optional process, and returns the last
6237 PROCESS to RESUME it.  If not given, the PROCESS is <ME>.  If no
6238 process has ever RESUMEd the process given, returns FALSE.
6239
6240 Argument:
6241
6242   Template:  #DECL ("VALUE" <OR FALSE PROCESS> "OPTIONAL" PROCESS)
6243
6244 (Optional)
6245 Argument 1 -- A PROCESS, default <ME>.
6246 Returns -- A PROCESS, which last RESUMEd Arg 1, or FALSE if none ever
6247         did.
6248
6249 Example:  <PROG ((R <RESUMER>))
6250                 <COND (<AND .R <==? <STATE .R> RESUMABLE>>
6251                        <RESUME T .R>)>>
6252 RESUME RESUMER if o.k. to do so.
6253 \f
6254 RETRY:    Retry a previous Subroutine call from the error level
6255
6256 Object-type:  SUBR
6257
6258 Category:  ERROR, PROGRAM-CONTROL
6259
6260 Reference:  FRAME
6261
6262 RETRY pops the stack down to a given frame and then causes the
6263 Subroutine call that generated that frame to be done again.  It is
6264 mostly useful for restarting some program after fixing the cause of an
6265 error.
6266
6267 Argument:
6268
6269   Template:  #DECL ("OPTIONAL" FRAME)
6270
6271 (Optional)
6272 Argument 1 -- the frame to be redone, default the last call to ERROR/LISTEN
6273 Returns -- really nothing
6274
6275 Example:  <RETRY <FRM 1>>
6276 Often you want to restart from just before the error.
6277 \f
6278 RETURN:   Return something from an activation
6279
6280 Object-type:  SUBR
6281
6282 Category:  PROGRAM-CONTROL
6283
6284 Reference:  ERRET, GO, RETRY
6285
6286      RETURN takes a value and an ACTIVATION and returns the value
6287 from the ACTIVATION.  The ACTIVATION is optional, and defaults to the
6288 most nearly surrounding ACTIVATION, usually that of the current PROG
6289 or REPEAT.  The value is also optional, default T.
6290      The result of RETURN is that the ACTIVATION terminates and the
6291 value is returned as its 'result'.
6292      ACTIVATIONs may be implicit, as in they often are in PROGs and
6293 REPEATs, or explicit as in the optional first argument for PROG,
6294 REPEAT, FUNCTION, and second argument for DEFINE.  In these cases the
6295 LVAL of the ATOM given is the ACTIVATION of that PROG, REPEAT, etc.
6296 See the Abstracts of these FSUBRs and the Abstract of AGAIN for more
6297 details.
6298      One final note.  An ACTIVATION may be CHTYPEd to a FRAME and used
6299 by ERRET, RETRY and so on.
6300      The ACTIVATION argument to RETURN may literally be any legal
6301 activation in the MUDDLE, even one from another PROCESS.
6302
6303 Argument:
6304
6305   Template:  #DECL ("VALUE" ANY "OPTIONAL" ANY ACTIVATION)
6306
6307 (Optional)
6308 Argument 1 -- the value to return from the activation, default T.
6309 Argument 2 -- the ACTIVATION to return the value from, default the
6310         most closely surrounding ACTIVATION, as of the current PROG
6311         or REPEAT that is running.
6312 Returns -- Argument 1 (from the ACTIVATION).
6313
6314 Example:  <REPEAT (X)
6315                   <COND (<EMPTY? .X> <RETURN "DONE">)
6316                         (ELSE <PRINT <1 .X>>)>
6317                   <SET X <REST .X>>>
6318 Simple use of RETURN in a REPEAT.
6319 \f
6320 RGLOC:    Get a locative to the GVAL of an ATOM for pure-program use
6321
6322 Object-type:  SUBR
6323
6324 Category:  DATA-HANDLING
6325
6326 Reference:  LLOC, GLOC
6327
6328      Returns a locative, type LOCR, to the GVAL of the ATOM passed
6329 as its argument.  If the ATOM has no GVAL slot, ERROR, unless second
6330 arg is given and true.  Pure RSUBRs must use this instead of GLOC.
6331
6332 Argument:
6333
6334   Template:  #DECL ("VALUE" LOCR ATOM "OPTIONAL" <OR FALSE ANY>)
6335
6336 Argument 1 -- An ATOM with a GVAL.
6337 (Optional)
6338 Argument 2 -- whether not to give a no-slot error or not
6339 Returns -- A locative (LOCR) to the GVAL of the ATOM.
6340
6341 Example:  <AND <GASSIGNED? FOO> <RGLOC FOO>>
6342 Guard against ATOMs with no GVALs.
6343 \f
6344 ROOT:     Return the ROOT oblist
6345
6346 Object-type:  SUBR
6347
6348 Category:  IDENTIFIER
6349
6350      ROOT returns the ROOT OBLIST.  This OBLIST is almost always
6351 in the path.
6352
6353 Argument:
6354
6355   Template:  #DECL ("VALUE" OBLIST)
6356
6357 Returns -- The ROOT OBLIST.
6358
6359 Example:  <ROOT>
6360 Only one there is.
6361 \f
6362 ROT:     Logical rotate
6363
6364 Object-type:  SUBR
6365
6366 Category:  BIT-TWIDDLING, LOGICAL
6367
6368 Reference:  LSH
6369
6370      ROT takes an object of Primtype WORD and a FIX, and it returns a
6371 WORD containing the bits in the first argument, rotated the number of
6372 bits specified by the second argument (mod 256).  A positive second
6373 argument specifies rotation to the left, a negative FIX specifies
6374 rotating to the right.  Rotation is a cyclic logical shift where bits
6375 shifted out at one end are put back in at the other.
6376
6377 Argument:
6378
6379   Template:  #DECL ("VALUE" WORD
6380                     <PRIMTYPE WORD> FIX)
6381
6382 Arg 1 -- a Primtype WORD containing the bits to rotate
6383 Arg 2 -- a FIX specifying the amount to rotate
6384 Returns -- A WORD containing the rotated bits.
6385
6386 Example:  <ROT 8 6>
6387           #WORD *000000001000*
6388           <ROT 8 -6>
6389           #WORD *100000000000*
6390 Primarily useful for getting fingers directly in the bits.
6391 \f
6392 RSUBR-ENTRY: Create entry point to an RSUBR.
6393
6394 Object-type:  SUBR
6395
6396 Category:  DATA-HANDLING
6397
6398 Reference:  RSUBR, ENTRY-LOC
6399
6400      This routine will create an alternate entry point to an RSUBR.
6401 The ATOM supplied will be the name of this alternate entry point.  The
6402 DECL will be used for argument and result checking at the new entry.
6403 The FIX is the offset into the actual code of the RSUBR of this entry.
6404
6405 Argument:
6406
6407   Template:  #DECL ("VALUE" RSUBR-ENTRY
6408                     <VECTOR <OR RSUBR ATOM> ATOM DECL> FIX)
6409
6410 Argument 1 -- a vector containing the RSUBR (or its name) and the new
6411         entry's name and DECL
6412 Argument 2 -- a FIX, an offset in the RSUBR
6413 Returns -- an RSUBR-ENTRY into the RSUBR
6414
6415 Example:  <RSUBR-ENTRY [,FOO FOO1 #DECL ("VALUE" LIST STRING)]
6416                        245>
6417
6418 This will make a new entry point into the RSUBR FOO.  This entry will
6419 have the name FOO1 and have a DECL as given.  The offset into the CODE
6420 of FOO for this entry will be 245.
6421 \f
6422 RSUBR-LINK: Change state of automatic RSUBR linking feature
6423
6424 Object-type:  SUBR
6425
6426 Category:  ENVIRONMENT
6427
6428 Reference:  RSUBR
6429
6430      RSUBR-LINK is used to enable and disable the automatic RSUBR
6431 linking feature of MUDDLE.  Normally, as they are called, RSUBRs link
6432 up to each other.  If RSUBRs are being debugged, this can be a problem
6433 as several different versions may be loaded and reloaded.
6434      Calling RSUBR-LINK with FALSE disables the feature, with non-FALSE
6435 enables it.  It is normally enabled.
6436
6437 Argument:
6438
6439   Template:  #DECL ("VALUE" <OR ANY FALSE>
6440                     "OPTIONAL" <OR ANY FALSE>)
6441
6442 (Optional)
6443 Argument 1 -- FALSE disables automatic RSUBR linking, non-FALSE
6444         enables it.
6445 Returns -- The previous state, or the current state if no arg
6446
6447 Example:  <RSUBR-LINK <>>
6448           <GROUP-LOAD "FOO BINARY">
6449 .....debugging.....
6450           <RSUBR-LINK T>
6451 Done debugging.
6452 \f
6453 RSUBR:    Create an object of type RSUBR (Relocatable SUBR)
6454
6455 Object-type:  SUBR
6456
6457 Category:  DATA-HANDLING
6458
6459     RSUBR is a routine that is rarely if ever used other than in the
6460 MUDDLE Assembler.  The user (almost) always sees the type RSUBR already
6461 created.
6462      RSUBR creates an object of RSUBR, which stands for Relocatable
6463 SUBR.  RSUBRs are created in one of several ways.  They can be created
6464 by hand-coding a routine and assembling it.  They can be the result of
6465 the assembly of a compiled FUNCTION.
6466       Internally, an RSUBR consists of a code uvector, a name, a DECL,
6467 and (optionally) references, which are all the objects the
6468 RSUBR references outside of itself.
6469
6470 Argument:
6471
6472   Template:  #DECL ("VALUE" RSUBR
6473                     <VECTOR <OR CODE PCODE> ATOM DECL [REST ANY]>)
6474
6475 Argument 1 -- A VECTOR containing the code (impure or pure), an ATOM (the
6476      name of the RSUBR), a DECL, and references.
6477 Returns -- The argument CHTYPEd to an RSUBR.
6478
6479 Example:  <RSUBR [#CODE ![1!] FOO #DECL ()]>
6480 Will create a useless RSUBR
6481 \f
6482 RUNINT:   Apply interrupt handler (for internal use only)
6483
6484 Object-type:  SUBR
6485
6486 Category:  SYSTEM, INTERRUPT
6487
6488 Reference:  APPLY
6489
6490 RUNINT is just like APPLY, except that it is called internally to
6491 execute an interrupt handler.  It may cause another PROCESS to run.
6492
6493 Argument:
6494
6495   Template:  #DECL ("VALUE" ANY APPLICABLE "TUPLE" TUPLE)
6496
6497 Argument 1 -- the handler to be applied
6498 Tuple of arguments -- its args, supplied by interrupt system
6499 Returns -- whatever handler returns
6500
6501 Example:  <RUNINT <3 .HANDLER> !.ARGS>
6502 Of course only the interpreter does this.
6503 \f
6504 RUNTIMER: Set time of Run-time interrupt
6505
6506 Object-type:  SUBR
6507
6508 Category:  INTERRUPT
6509
6510 Reference:  REALTIMER
6511
6512      RUNTIMER sets the amount of Run-time (in seconds) the MUDDLE
6513 must have used for a RUNT (run-time) interrupt to occur.
6514
6515 Argument:
6516
6517   Template:  #DECL ("VALUE" <OR FIX FLOAT> <OR FIX FLOAT>)
6518
6519 Argument 1 -- The amount of run-time (fix or float) the MUDDLE must
6520         have used for a RUNT (run-time) interrupt to occur.
6521 Returns -- Argument 1.
6522
6523 Example:  <RUNTIMER <* 60 60>>
6524 Cause interrupt after one hour time (seconds) used.
6525 \f
6526 SAVE:     Saves the core image of a MUDDLE in a continuable state.
6527
6528 Object-type:  SUBR
6529
6530 Category:  I/O
6531
6532 Reference:  FSAVE, RESTORE
6533
6534      SAVE saves the impure part of a MUDDLE's core image in a file on
6535 the disk.  This file can later be RESTOREd (q.v.) and whatever was in
6536 progress continued.
6537      SAVE files are zero compressed, and normally a garbage collection
6538 is performed before the SAVE is done to further reduce the rather
6539 considerable size of the resulting file.
6540      SAVE takes the name of the file to SAVE into as its argument, and
6541 optionally, an argument which if given and FALSE, causes the garbage
6542 collect to not occur.  The default name of the SAVE file is DSK:MUDDLE
6543 SAVE.
6544      SAVE returns the string "SAVED".  RESTORE, which 'returns again'
6545 from the SAVE, returns the string "RESTORED", and thus the caller can
6546 differentiate.
6547      SAVE files are RESTOREable only into MUDDLEs with the same
6548 version number as the MUDDLE that SAVEd them.  To check if a SAVE file
6549 is compatible with a MUDDLE, compare the version number with <READ> on
6550 a channel open to the SAVE file.
6551
6552 Argument:
6553
6554   Template:  #DECL ("VALUE" '"SAVED" "TUPLE" TUPLE)
6555
6556 (Tuple of arguments)
6557 First element(s) -- STRING(s) specifying the file to SAVE into.
6558 Last element (optional) -- An object, which, if FALSE, inhibits pre-SAVE garbage
6559     collect.
6560 Returns -- the STRING "SAVED"
6561
6562 Example:  <SAVE>
6563 Will save core image to DSK:<sname>;MUDDLE SAVE.
6564 \f
6565 SEND-WAIT: Send an IPC message and wait until someone takes it
6566
6567 Object-type:  SUBR
6568
6569 Category:  SYSTEM
6570
6571 Reference:  SEND, IPC-ON, IPC-OFF
6572
6573      SEND-WAIT sends an IPC message to a specific destination from your
6574 MUDDLE, using the ITS IPC (Inter-process communication) feature.  SEND
6575 takes 3, 4, or 6 arguments:  Two string specifying whom to send the
6576 message to, a message, and optionally a message type number, and a
6577 pair of strings specifying whom the message is from.
6578      Using SEND-WAIT, it is possible to hang until someone takes the
6579 message.  SEND returns T if someone takes the message, #FALSE()
6580 otherwise.
6581      When your process receives an IPC message, the condition "IPC"
6582 is signalled.  There is a default handler for this condition, called
6583 IPC-HANDLER.   See its abstract for more details.
6584
6585 Argument:
6586
6587   Template:  #DECL ("VALUE" 'T STRING STRING
6588                     <OR STRING <UVECTOR [REST <PRIMTYPE WORD>]> STORAGE>
6589                     "OPTIONAL" FIX STRING STRING)
6590
6591 Arguments 1 & 2 -- STRINGs specifying the destination of the message.
6592         Any one who is listening on this pair will receive the message.
6593         They correspond to an ITS UNAME, JNAME pair.
6594 Argument 3 -- A message.  This can be a STRING, a UVECTOR of UTYPE
6595         Primtype WORD, or a STORAGE.
6596 (Optional)
6597 Argument 4 -- A message type.  This is just an identifying type for
6598         the recipient to look at if he is interested.
6599 Arguments 5 & 6 -- Two STRINGs specifying whom the message is from. If
6600         not given, they are from UNAME JNAME of the MUDDLE.
6601 Returns -- T when the message is taken.  Hangs until then.
6602
6603 Example:  <SEND-WAIT "CLR" "MUDDLE" "HOW ARE YOU CHRIS?">
6604 Will return T when CLR MUDDLE takes the IPC message.
6605 \f
6606 SEND:     Send an IPC message
6607
6608 Object-type:  SUBR
6609
6610 Category:  SYSTEM
6611
6612 Reference:  SEND-WAIT, IPC-ON, IPC-OFF
6613
6614      SEND sends an IPC message to a specific destination from your
6615 MUDDLE, using the ITS IPC (Inter-process communication) feature.  SEND
6616 takes 3, 4, or 6 arguments:  Two strings specifying whom to send the
6617 message to, a message, and optionally a message type number, and a
6618 pair of strings specifying whom the message is from.
6619      SEND returns T if someone takes the message, #FALSE() otherwise.
6620 Using SEND-WAIT, it is possible to hang until someone takes the message.
6621      When your process receives an IPC message, the condition "IPC"
6622 is signalled.  There is a default handler for this condition, called
6623 IPC-HANDLER.   See its abstract for more details.
6624
6625 Argument:
6626
6627   Template:  #DECL ("VALUE" <OR 'T '#FALSE ()> STRING STRING
6628                     <OR STRING <UVECTOR [REST <PRIMTYPE WORD>]> STORAGE>
6629                     "OPTIONAL" FIX STRING STRING)
6630
6631 Arguments 1 & 2 -- STRINGs specifying the destination of the message.
6632         Any one who is listening on this pair will receive the message.
6633         They correspond to an ITS UNAME, JNAME pair.
6634 Argument 3 -- A message.  This can be a STRING, a UVECTOR of UTYPE
6635         Primtype WORD, or a STORAGE.
6636 (Optional)
6637 Argument 4 -- A message type.  This is just an identifying type for
6638         the recipient to look at if he is interested.
6639 Arguments 5 & 6 -- Two STRINGs specifying whom the message is from. If
6640         not given, they are from UNAME JNAME of the MUDDLE.
6641 Returns -- T if the message is taken, else #FALSE ().
6642
6643 Example:  <SEND "CLR" "MUDDLE" "HOW ARE YOU CHRIS?">
6644 Will return T only if CLR MUDDLE is listening for IPC messages.
6645 \f
6646 SET:      Give an atom a local value
6647
6648 Object-type:  SUBR
6649
6650 Category:  IDENTIFIER
6651
6652 Reference:  ASSIGNED?, LVAL
6653
6654         SET gives an atom (arg1) a local value (arg2) in a given
6655 environment (arg3, optional).
6656
6657 Argument:
6658
6659   Template:  #DECL ("VALUE" ANY ATOM ANY
6660                     "OPTIONAL" <OR ENVIRONMENT
6661                                    ACTIVATION
6662                                    FRAME
6663                                    PROCESS>)
6664
6665 Argument 1 -- the atom to set
6666 Argument 2 -- the local value to give it
6667 (Optional)
6668 Argument 3 -- the environment for this to occur in
6669 Returns -- arg2
6670
6671 Example:  <SET REDEFINE T>
6672 allows redefinitions
6673 \f
6674 SETG:     Assign a global value to an atom
6675
6676 Object-type:  SUBR
6677
6678 Category:  IDENTIFIER
6679
6680 Reference:  GVAL, GASSIGNED?, DEFINE
6681
6682
6683 Argument:
6684
6685   Template:  #DECL ("VALUE" ANY ATOM ANY)
6686
6687 Argument 1 -- the atom
6688 Argument 2 -- the global value to give it
6689 Returns -- arg2
6690
6691 Example:  <SETG REAL-PLUS ,+>
6692 often the first step in redefining primitives
6693 \f
6694 SETLOC:   Change the object a locative points to
6695
6696 Object-type:  SUBR
6697
6698 Category:  DATA-HANDLING
6699
6700 Reference:  IN, LEGAL?
6701
6702      Change the object a locative points to.  The advantage of SETLOC
6703 is that it is independent of exactly what is pointed to by the locative
6704 passed it.  It works equally well for LVALs, GVALs, structures, and
6705 so on.
6706      Note that it is possible to lose if an LVAL to which an LLOC
6707 points has become unbound.  Use LEGAL? to check when in doubt.
6708
6709 Argument:
6710
6711   Template:  #DECL ("VALUE" ANY LOCATIVE ANY)
6712
6713 Argument 1 -- A locative.
6714 Argument 2 -- Anything, to be the new contents of the thing the
6715         locative points at.
6716 Returns -- Argument 2.
6717
6718 Example:  <SET FOO (1 2 3)>
6719           <SET FOOL <AT .FOO 2>>
6720           <IN .FOOL>
6721           2
6722           <SETLOC .FOOL "BAR">
6723           .FOO
6724           (1 "BAR" 3)
6725 Just like PUT, right?
6726 \f
6727 SIN:      Sine of an angle
6728
6729 Object-type:  SUBR
6730
6731 Category:  ARITHMETIC
6732
6733 Reference:  COS, ATAN
6734
6735
6736 Argument:
6737
6738   Template:  #DECL ("VALUE" FLOAT <OR FIX FLOAT>)
6739
6740 Argument 1 -- the angle in radians.
6741 Returns -- A FLOAT, the Sine.
6742
6743 Example:  <+ <* <COS .X> <COS .X>>
6744              <* <SIN .X> <SIN .X>>>
6745           1.0
6746 One of the common trig. identities.
6747 \f
6748 SLEEP:    Sleep interruptably for a given number of seconds
6749
6750 Object-type:  SUBR
6751
6752 Category:  ENVIRONMENT, INTERRUPT
6753
6754 Reference:  HANG
6755
6756      SLEEP allows a process to sleep (using the system call) for
6757 a given period of time.  It is also possible to give an object to be
6758 evaluated each time an interrupt occurs and is dismissed back into
6759 the SLEEP.  If the result of the evaluation is non-FALSE, the result
6760 is returned as the value of the SLEEP.  This enables a switch to be
6761 set at interrupt level and looked at to terminate a SLEEP.
6762
6763 Argument:
6764
6765   Template:  #DECL ("VALUE" ANY <OR FIX FLOAT> "OPTIONAL" ANY)
6766
6767 Argument 1 -- the number of seconds to SLEEP.
6768 (Optional)
6769 Argument 2 -- Something to evaluate each time an interrupt dismisses
6770         back into the SLEEP, and terminates the SLEEP if it returns
6771         non-FALSE.
6772 Returns -- The non-FALSE result of the second argument.
6773
6774 Example:  <SLEEP 60 .TYPEIN>
6775
6776 Sleep for a minute but stop early if an interrupt handler sets the
6777 ATOM to a non-FALSE.
6778 \f
6779 SNAME:    Read or change MUDDLE's SNAME
6780
6781 Object-type:  SUBR
6782
6783 Category:  SYSTEM
6784
6785      Reads or changes MUDDLE's SNAME, which is the default name for
6786 opening files.  If no arguments are given, returns the current SNAME.
6787 If a STRING is given, it is made the current SNAME and returned.
6788      The ATOM SNM may also be set, locally or globally, to change
6789 (temporarily or permanently) the default SNAME of the MUDDLE.
6790
6791 Argument:
6792
6793   Template:  #DECL ("VALUE" STRING "OPTIONAL" STRING)
6794
6795 (Optional)
6796 Argument 1 -- A STRING to set the SNAME to.  If none is given, just
6797         read the current SNAME.
6798 Returns -- The current SNAME.
6799
6800 Example:  <SNAME "FOO">
6801 FOO
6802           <SNAME>
6803 FOO
6804 Set and read SNAME.
6805 \f
6806 SORT:     Sort VECTORs, UVECTORs, or TUPLEs
6807
6808 Object-type:  SUBR
6809
6810 Category:  DATA-HANDLING
6811
6812      SORT is used to order VECTORs, UVECTORs, and TUPLEs.  It is a
6813 fairly complex SUBR, which however has good defaults and is fairly
6814 easy to use with them.
6815      It works most efficiently if the sort keys are of primtype WORD,
6816 ATOM, or STRING.  However, the keys may be of any type, and SORT will
6817 still work.  SORT acts on records which consist of one or more contig-
6818 uous entries in the structure being sorted.  One item in the record is
6819 declared to be the sort key.  Also, any number of additional structures
6820 may be rearranged based on how the main structure is sorted.
6821
6822         <SORT function          ; either FALSE or something applicable
6823                                 ; to two sort keys which returns FALSE
6824                                 ; if the first is not bigger than the
6825                                 ; second.  I.e, arg1 > arg2 ??
6826
6827               s1                ; the structure to sort
6828
6829               l1                ; length of sort records in s1, default 1
6830
6831               offset            ; REST offset from start of record of
6832                                 ; sort key.  Optional, default 0.
6833
6834               s2 l2 - sN lN>    ; the VECTORs, UVECTORs, or TUPLEs to
6835                                 ; rearrange, and record lengths in them
6836
6837      If the function is FALSE, then the types of all the sort keys
6838 must be the same, and they must be of primtype WORD, ATOM, or STRING.
6839 In this case a Radix Exchange Sort is used (stolen from TECO).  If
6840 function is something applicable, a Shell Sort is used.
6841      Note that if you give your own 'function' it is possible to make
6842 a non-terminating sort.  If the condition you create by your function
6843 does not map into the normal one 'return FALSE if first not bigger than
6844 second' then the SORT may not terminate.
6845      See 'Example' section for several examples of the use of SORT.
6846
6847 Argument:
6848
6849   Template:  #DECL ("VALUE" <PRIMTYPE <OR VECTOR UVECTOR TUPLE>>
6850                     <OR FALSE APPLICABLE> <PRIMTYPE <OR VECTOR UVECTOR TUPLE>>
6851                     "OPTIONAL" FIX FIX "TUPLE"
6852                     <TUPLE [REST
6853                             <PRIMTYPE <OR VECTOR UVECTOR TUPLE>>
6854                             FIX]>)
6855
6856 Argument 1 -- The Sorting routine, or FALSE if the internal one is to
6857         be used.  Remember internal one only works if keys are WORD,
6858         ATOM, STRING primtypes.
6859 Argument 2 -- The PRIMTYPE VECTOR, UVECTOR, or TUPLE to sort.
6860 (Optional)
6861 Argument 3 -- FIX giving the record size in the
6862         structure given for argument 2.  Defaults to 1 if not
6863         given.
6864 Argument 4 -- The REST offset of the sort key in the records of the main
6865         structure.  Default is 0.
6866 Tuple of arguments -- Alternating structures and respective record sizes.
6867         These records are permuted the same way as the sorted ones in
6868         the main structure.
6869 Returns -- the sorted arg 1
6870
6871 Example:  <SET A <IUVECTOR 500 '<RANDOM>>>
6872           <SORT <> .A>
6873
6874 This is the simplest use of SORT.  Note that only one argument is
6875 really given, the FALSE simply defaulting the sorting method to the
6876 internal one.
6877           <SORT <>
6878                 [foo
6879                  1
6880                  bar
6881                  2
6882                  blech
6883                  -1
6884                  crock
6885                  69]
6886                 2>
6887
6888 This sorts the vector based on the atom names, considering records
6889 to be two elements and defaulting the offset to 0.  If the offset had
6890 been 1 would sort based on the numbers.
6891           <SORT <FUNCTION (X Y) 
6892                         <G? <1 .X> <1 .Y>>>
6893                 [(101 "FOOBAR") (17 "MUMBLE") (86 "BLECH") (34 "GRITCH")]
6894                 1
6895                 0
6896                 [A
6897                  B
6898                  C
6899                  D
6900                  E
6901                  F
6902                  G
6903                  H
6904                  I
6905                  J
6906                  K
6907                  L]
6908                 3>
6909
6910 This sorts two structures based on the first element of the main
6911 structure.  Note that records in the second structure are 3 elements
6912 long.
6913 \f
6914 SPECIAL-CHECK: Change or examine the state of interpreter SPECIAL checking
6915
6916 Object-type:  SUBR
6917
6918 Category:  ENVIRONMENT
6919
6920 Reference:  SPECIAL-MODE, DECL-CHECK
6921
6922      SPECIAL-CHECK turns interpreter SPECIAL checking on or off,
6923 returning the old state, or, if given no argument, returns the current
6924 state.  (T indicates special checking is on, #FALSE() off).
6925
6926 Argument:
6927
6928   Template:  #DECL ("VALUE" <OR 'T FALSE>
6929                     "OPTIONAL" <OR ANY FALSE>)
6930
6931 (Optional arguments)
6932 Argument 1 -- A FALSE or T, indicating which state special checking is
6933         to be put in.  If not given, just return current state.
6934 Returns -- The state of special-checking when SPECIAL-CHECK was called.
6935
6936 Example:  <SPECIAL-CHECK <>>
6937 This sets the normal initial state -- no special checking.
6938 \f
6939 SPECIAL-MODE: Change or examine the default Special Mode
6940
6941 Object-type:  SUBR
6942
6943 Category:  ENVIRONMENT
6944
6945 Reference:  SPECIAL-CHECK
6946
6947      SPECIAL-MODE is used to change or examine the default special
6948 mode.  It takes as argument the atoms SPECIAL or UNSPECIAL, and sets
6949 the default mode accordingly, returning the old mode.  If no argument
6950 is given, it just returns the old mode.
6951
6952 Argument:
6953
6954   Template:  #DECL ("VALUE" <OR 'SPECIAL 'UNSPECIAL>
6955                     "OPTIONAL" <OR 'SPECIAL 'UNSPECIAL>)
6956
6957 (Optional arguments)
6958 Argument 1 -- SPECIAL or UNSPECIAL, the new mode.
6959 Returns -- The mode at the time of the call.
6960
6961 Example:  <SPECIAL-MODE UNSPECIAL>
6962 Set the initial state.
6963 \f
6964 SPNAME:   Create a shared STRING which is the name of an ATOM
6965
6966 Object-type:  SUBR
6967
6968 Category:  IDENTIFIER
6969
6970 Reference:  ATOM, INSERT, PNAME
6971
6972      SPNAME takes as argument an ATOM, and returns the STRING which
6973 is the PNAME (printing name) of that ATOM.  This name does not include
6974 any oblist trailers or the backslashes that are sometimes printed out
6975 for the convenience of the reader.  Several other SUBRs, notably
6976 INSERT, LOOKUP, and ATOM, use the pname of atoms as arguments.
6977      PRINC of the PNAME of an ATOM is one guaranteed way of printing
6978 an ATOM-name without trailers, backslashes, or quotes.
6979      SPNAME is more efficient than PNAME (q.v.) if the string will not
6980 be modified.  Any attempt to PUT into the string will cause an error.
6981
6982 Argument:
6983
6984   Template:  #DECL ("VALUE" STRING ATOM)
6985
6986 Argument 1 -- An ATOM.
6987 Returns -- A STRING which shares the atom's pname.
6988
6989 Example:  <SPNAME \ \ \ !-FOO!-BAR>
6990    
6991 Just three spaces, no backslashes, no trailers.
6992 \f
6993 SQRT:     Square root of a number
6994
6995 Object-type:  SUBR
6996
6997 Category:  ARITHMETIC
6998
6999 Reference:  LOG, EXP
7000
7001
7002 Argument:
7003
7004   Template:  #DECL ("VALUE" FLOAT <OR FIX FLOAT>)
7005
7006 Argument 1 -- A FIX or FLOAT.
7007 Returns -- FLOAT, the square root of argument 1.
7008
7009 Example:  <SQRT 4>
7010           2.0
7011 Floating is always done.
7012 \f
7013 SQUOTA:   Get the address of an internal interpreter symbol (for internal use only)
7014 "VALUE" <OR FIX FALSE>
7015 <PRIMTYPE WORD>
7016 \f
7017 STACKFORM: Apply a function to generated arguments.         [OBSOLETE]
7018
7019         ******* This FSUBR is obsolete as of MUD54 *******
7020
7021 Object-type:  FSUBR
7022
7023 Category:  DATA-HANDLING
7024
7025      STACKFORM is obsolete and replaced by a MAPF of only two arguments.
7026 It is documented for historical reasons only.  The compiler transforms
7027 applications of STACKFORM into appropriate MAPFs.
7028
7029      The STACKFORM Fsubr was used to APPLY a function to a variable
7030 number of generated arguments.  This could also be done by constructing
7031 the appropriate Form and EVALing it.  STACKFORM is more efficient; it
7032 builds the Form on the stack and therefore produces no garbage.  This
7033 is where STACKFORM obtains its name.
7034      STACKFORM operates as follows:
7035         (0) EVALuate the 1st arg, and save as the applicative object.
7036         (1) EVALuate the 3rd arg, the boolean expression.
7037         (2) If the 3rd arg EVALuated to an object not of Type FALSE
7038                 Then, EVALuate the 2nd arg, the argument expression
7039                         and save on the stack. GO TO (1)
7040                 Else APPLY the saved applicative object
7041                         to the stacked arguments and return the result.
7042
7043 Argument:
7044
7045   Template:  #DECL ("VALUE" ANY "ARGS" <LIST APPLICABLE ANY ANY>)
7046
7047 Arguments -- see Description.
7048 Returns -- see Description.
7049
7050 Example:  <STACKFORM ,STRING
7051                      <READCHR>
7052                      <NOT <==? <NEXTCHR> <ASCII 27>>>>
7053
7054 This reads characters from the current input channel until an alt-mode
7055 is read.  It then returns what was read as one String.
7056 \f
7057 STATE:    Return the state of a PROCESS
7058
7059 Object-type:  SUBR
7060
7061 Category:  PROCESS-CONTROL
7062
7063      STATE returns the state of a PROCESS, as an ATOM from the
7064 following list:
7065
7066 a) RUNNABLE -- PROCESS has never been run.
7067 b) RUNNING -- running now (ie: applied STATE).
7068 c) RESUMABLE -- has run and may run again.
7069 d) DEAD -- has run and may not run again.
7070
7071 Argument:
7072
7073   Template:  #DECL ("VALUE" ATOM PROCESS)
7074
7075 Argument 1 -- A PROCESS whose state should be returned.
7076 Returns -- The state of the PROCESS
7077
7078 Example:  <STATE <ME>>
7079           RUNNING
7080 This should always be the case.
7081 \f
7082 STORE:    Create a non-garbage collected storage area       [OBSOLETE]
7083
7084         ******* This SUBR is obsolete as of MUD55 *******
7085
7086 Object-type:  SUBR
7087
7088 Category:  DATA-HANDLING
7089
7090 Reference:  ISTORAGE, FREE
7091
7092      STORE creates non-g.c. storage (for E&S etc.). It looks just like
7093 a uvector, but does not move during garbage collection.  It takes as
7094 argument a UVECTOR whose contents will be copied into the STORAGE.
7095
7096 Argument:
7097
7098   Template:  #DECL ("VALUE" STORAGE UVECTOR)
7099
7100 Argument 1 -- UVECTOR, desired contents of the store.
7101 Returns -- STORAGE, containing old contents of the UVECTOR.
7102
7103 Example:  <PROG ()
7104                 <SET A <STORE ![1 2 3!]>>
7105                 (.A <1 .A> <FREE .A>)>
7106 Notice that once the space is free'd it should not be accessed
7107 \f
7108 STRCOMP:  Compare two STRINGs
7109
7110 Object-type:  SUBR
7111
7112 Category:  PREDICATE, CHARACTER
7113
7114 Reference:  =?
7115
7116      STRCOMP alphabetically compares two STRINGs or ATOMs.  It
7117 actually is not a predicate, since it can return one of three values:
7118           0 if the first string is =? to the second,
7119           1 if the first is greater (sorts alphabetically after the
7120                  second),
7121      and -1 if the second is greater.
7122
7123      If STRCOMP is given ATOMs, it of course uses their pnames to
7124 compare them.
7125
7126      Alphabetically means, in this case, according to the numeric
7127 order of ASCII, which gives the standard alphabetizing rules.
7128
7129 Argument:
7130
7131   Template:  #DECL ("VALUE" FIX <OR ATOM STRING> <OR ATOM STRING>)
7132
7133 Argument 1 -- STRING or ATOM
7134 Argument 2 -- STRING or ATOM
7135 Returns -- 0 if argument 1 is =? to argument 2.
7136            1 if argument 1 is greater than argument 2.
7137           -1 if argument 1 is less than argument 2.
7138
7139 Example:  <STRCOMP "FOO" "BAR">
7140           1
7141           <G? <STRCOMP "FOO" "BAR"> 0>
7142           T
7143 Converts STRCOMP into a predicate suitable for SORT.
7144 \f
7145 STRING:   Create a STRING from CHARACTERs and STRINGs
7146
7147 Object-type:  SUBR
7148
7149 Category:  DATA-HANDLING
7150
7151 Reference:  ISTRING
7152
7153      STRING creates a string with explicit elements.  These must be
7154 other STRINGs or CHARACTERs.  They will be concatenated together to
7155 form a new STRING.
7156
7157 Argument:
7158
7159   Template:  #DECL ("VALUE" STRING
7160                     "TUPLE" <TUPLE [REST <OR STRING CHARACTER>]>)
7161
7162 Tuple of arguments -- STRINGs or CHARACTERs, the elements of the new
7163         STRING.
7164 Returns -- Newly created STRING.
7165
7166 Example:  <STRING "This is " !\a " string">
7167 This is a string
7168 \f
7169 STRUCTURED?: Is an object structured?
7170
7171 Object-type:  SUBR
7172
7173 Category:  TYPE, PREDICATE
7174
7175 Reference:  TYPE?, LOCATIVE?, APPLICABLE?
7176
7177      STRUCTURED? tests if an object is one of the group of types
7178 known as structured objects.  It is similar to applying TYPE? to
7179 the object and the list of structured objects, but relieves the user
7180 from knowing the list, and thus will work for any new structured types
7181 invented.
7182      A structured object is defined as an object which potentially may
7183 have NTH applied to it.
7184
7185 Argument:
7186
7187   Template:  #DECL ("VALUE" <OR FALSE 'T> ANY)
7188
7189 Argument 1 -- Any MUDDLE object.
7190 Returns -- T if argument 1 is structured, or FALSE if it is not.
7191
7192 Example:  <STRUCTURED? <ROOT>>
7193           T
7194 Lots of types are structured.
7195 \f
7196 SUBSTITUTE: Substitute one type-value pair for another throughout MUDDLE
7197
7198 Object-type:  SUBR
7199
7200 Category:  DATA-HANDLING
7201
7202 Reference:  GC
7203
7204      SUBSTITUTE causes one type-value pair to be substituted for
7205 another throughout MUDDLE.  It is not to be used unless you really
7206 know what you are doing.  In fact, one of the few legitimate uses for
7207 it (other than just having fun by doing <SUBSTITUTE 2 1>) is to
7208 substitute the 'right' atom for the 'wrong' one, where OBLISTs have
7209 gotten in a bad state.
7210
7211 Argument:
7212
7213   Template:  #DECL ("VALUE" ANY ANY ANY)
7214
7215 Argument 1 -- Object to be substituted.
7216 Argument 2 -- Object to be substituted for.
7217 Returns -- Argument 2.
7218
7219 Example:  <SUBSTITUTE FOO!-BAR FOO>
7220
7221 Only reasonable use so far found.  ATOM impurification is done this
7222 way, more or less.
7223 \f
7224 SUBSTRUC: Copy part of a structure into another
7225
7226 Object-type:  SUBR
7227
7228 Category:  DATA-HANDLING
7229
7230         SUBSTRUC facilitates the construction of structures that are
7231 composed of sub-parts of existing structures.  It copies a set of
7232 contiguous elements of one (non-TEMPLATE) structure into the first
7233 elements of another, old or new, structure, all in one swell foop.
7234
7235 Argument:
7236
7237   Template:  #DECL ("VALUE" <OR LIST VECTOR UVECTOR STRING BYTES>
7238                     <OR <PRIMTYPE LIST>
7239                         <PRIMTYPE VECTOR>
7240                         <PRIMTYPE TUPLE>
7241                         <PRIMTYPE UVECTOR>
7242                         <PRIMTYPE STRING>
7243                         <PRIMTYPE BYTES>>
7244                     "OPTIONAL" FIX FIX
7245                     <OR LIST VECTOR UVECTOR STRING BYTES>)
7246
7247 Argument 1 -- object to copy out of
7248 (Optional)
7249 Argument 2 -- amount to REST arg1 (temporarily) before copying, default 0
7250 Argument 3 -- number of elements to copy, default all
7251 Argument 4 -- object to copy into, TYPE must be <PRIMTYPE arg1> (VECTOR
7252         if arg1 is TUPLE), must not share with arg1 if LIST
7253 Returns -- new object (doesn't share with arg1, VECTOR if arg1 is TUPLE)
7254         or arg4
7255
7256 Example:  <SUBSTRUC '(1 2 3) 0 2>
7257           (1 2)
7258 opposite of REST
7259           <SUBSTRUC "SUM OF PARTS" 7 4 <ISTRING 4>>
7260           "PART"
7261 substring function
7262 \f
7263 SUICIDE:  Kill the PROCESS you are in and resume another
7264
7265 Object-type:  SUBR
7266
7267 Category:  PROCESS-CONTROL
7268
7269 Reference:  PROCESS, RESUME, DEAD
7270
7271     SUICIDE is exactly like RESUME, except that the PROCESS it is
7272 EVALed in is made DEAD after it is left, and thus cannot be RESUMEd
7273 any longer.
7274      Note that <MAIN> cannot be SUICIDEd.
7275
7276 Argument:
7277
7278   Template:  #DECL ("VALUE" ANY ANY "OPTIONAL" PROCESS)
7279
7280 Argument 1 -- The value of the process doing the SUICIDE.
7281 (Optional)
7282 Argument 2 -- A PROCESS to RESUME, default <RESUMER>, if there is one.
7283 Returns -- Nothing really, as the PROCESS SUICIDEd cannot be RESUMEd,
7284         since it will be dead.
7285
7286 Example:  <SUICIDE T>
7287 Won't work if <ME> is <MAIN>
7288 \f
7289 TAG:      Create a tag within an activation
7290
7291 Object-type:  SUBR
7292
7293 Category:  PROGRAM-CONTROL
7294
7295 Reference:  GO
7296
7297         TAG creates a tag for a non-local GO.  GO with a tag argument
7298 allows returning to the middle of any PROG or REPEAT still active.
7299
7300 Argument:
7301
7302   Template:  #DECL ("VALUE" TAG ATOM)
7303
7304 Argument 1 -- a legal argument for local GOs
7305 Returns -- a TAG for non-local GOs
7306
7307 Example:  <PROG (&)
7308                 &
7309                 LABEL
7310                 <FOO>
7311                 &
7312                 <LOWER .BAR <TAG LABEL>>
7313                 &>
7314 See how easy it is to make confusing programs?
7315 \f
7316 TERPRI:   Print a carriage-return and line-feed
7317
7318 Object-type:  SUBR
7319
7320 Category:  I/O
7321
7322 Reference:  CRLF
7323
7324
7325 Argument:
7326
7327   Template:  #DECL ("VALUE" '#FALSE () "OPTIONAL" CHANNEL)
7328
7329 (Optional)
7330 Argument 1 -- the channel, default .OUTCHAN
7331 Returns -- #FALSE ()
7332
7333 Example:  <TERPRI>
7334           #FALSE ()
7335 Terminate printing on this line.
7336 \f
7337 TIME:     Return the Run time of the MUDDLE
7338
7339 Object-type:  SUBR
7340
7341 Category:  UTILITY, SYSTEM
7342
7343      TIME returns a FLOAT giving the run time of the MUDDLE in
7344 seconds.
7345      TIME takes any number of optional arguments, however, and is thus
7346 often used to pass arguments for examination at a DDT break point.
7347
7348 Argument:
7349
7350   Template:  #DECL ("VALUE" FLOAT "TUPLE" <TUPLE [REST ANY]>)
7351
7352 (Optional)
7353 Tuple of arguments -- ANY objects.
7354 Returns -- FLOAT, the run time of the MUDDLE in seconds.
7355
7356 Example:  <TIME>
7357           69.104992
7358 Run time.
7359 \f
7360 TOP:      Replace elements of a structure removed by REST
7361
7362 Object-type:  SUBR
7363
7364 Category:  DATA-HANDLING
7365
7366 Reference:  BACK, REST
7367
7368      TOP replaces all items removed from a non-list structure by
7369 RESTing.  For PRIMTYPE VECTORs, UVECTORs, STRINGs, and TEMPLATEs, TOP
7370 returns the object passed after having returned the pointer to the top
7371 of the object and changed the type to the PRIMTYPE.  Since list
7372 structures have no back pointers, it is impossible to either BACK them
7373 or TOP them.
7374
7375 Argument:
7376
7377   Template:  #DECL ("VALUE" <OR VECTOR UVECTOR STRING TEMPLATE>
7378                     <PRIMTYPE <OR VECTOR UVECTOR STRING TEMPLATE>>)
7379
7380 Argument 1 -- A structured object that can be BACKed (VECTOR, UVECTOR,
7381         STRING, or TEMPLATE.
7382 Returns -- The object with the RESTed elements (if any) returned and
7383         changed to its PRIMTYPE.
7384
7385 Example:  <==? <TOP <REST <SET X "FOOBARBLECH"> 6>>
7386                .X>
7387
7388 This will return T, as the same object is always there, just with a
7389 different pointer into it.
7390 \f
7391 TTYECHO:  Turn TTY echoing for a CHANNEL on and off
7392
7393 Object-type:  SUBR
7394
7395 Category:  I/O
7396
7397 Reference:  TYI
7398
7399      TTYECHO takes a channel and a FALSE or non-FALSE, ands sets
7400 the TTY echoing for that channel to 'off' if FALSE, 'on' if non-FALSE.
7401      This is useful in conjunction with the SUBR TYI (qv) for applic-
7402 ations where TTY echoing is not straight character at a time.
7403      ERROR and LISTEN automatically do <TTYECHO .INCHAN T> when they
7404 are called.
7405
7406 Argument:
7407
7408   Template:  #DECL ("VALUE" CHANNEL CHANNEL <OR ANY FALSE>)
7409
7410 Argument 1 -- A TTY CHANNEL.
7411 Argument 2 -- non-FALSE to turn on echoing, FALSE to turn it off.
7412 Returns -- The channel.
7413
7414 Example:  <TTYECHO .INCHAN T>
7415 ERROR and LISTEN do this automatically.
7416 \f
7417 TUPLE:    Create a TUPLE with explicit elements
7418
7419 Object-type:  SUBR
7420
7421 Category:  DATA-HANDLING
7422
7423 Reference:  ITUPLE
7424
7425      TUPLE creates a tuple (vector on the stack) with explicit
7426 elements.  TUPLE can only be invoked at top level of an atom-value
7427 pair in a parameter list, such as AUX or OPTIONALs, or the top binding
7428 pairs of PROG or REPEAT.
7429      Note that a TUPLE cannot be returned past the FRAME in which it
7430 was bound.
7431
7432 Argument:
7433
7434   Template:  #DECL ("VALUE" TUPLE "TUPLE" TUPLE)
7435
7436 Tuple of arguments -- ANY, the elements of the TUPLE.
7437 Returns -- Newly stacked TUPLE.
7438
7439 Example:  <PROG ((X <TUPLE 1 2 3 4>)) <+ !.X>>
7440 This is a legitimate, if trivial, use of TUPLE.
7441           <PROG ((X <REST <TUPLE 1 2 3 4>>))
7442                 <+ !.X>>
7443
7444 This use of TUPLE is both trivial and illegal:  it is not at top level
7445 of the atom-value pair.
7446 \f
7447 TYI:      Read a single character as it is typed on the TTY
7448
7449 Object-type:  SUBR
7450
7451 Category:  I/O
7452
7453 Reference:  TTYECHO
7454
7455      TYI is used to read characters from the TTY as they are typed
7456 rather than after an alt-mode is typed, as is the case with READCHR
7457 and READ.  It may be used in conjunction with TTYECHO by programs
7458 that wish to do their own reading and echoing.
7459
7460 Argument:
7461
7462   Template:  #DECL ("VALUE" CHARACTER "OPTIONAL" CHANNEL)
7463
7464 Argument 1 -- A TTY channel on which to read a character, default .INCHAN.
7465 Returns -- The character read.
7466
7467 Example:  <TTYECHO .INCHAN <>>
7468           <REPEAT ()
7469                   <PRINC <CHTYPE <+ 32 <CHTYPE <TYI .INCHAN> FIX>> CHARACTER>
7470                          .INCHAN>>
7471 Turn echoing off and echo characters read as their value plus 40.
7472 \f
7473 TYPE-C:   Get a type code for pure-program use
7474
7475 Object-type:  SUBR
7476
7477 Category:  TYPE-DEFINITION
7478
7479 Reference:  NEWTYPE, TYPE-W
7480
7481
7482 Argument:
7483
7484   Template:  #DECL ("VALUE" TYPE-C ATOM "OPTIONAL" ATOM)
7485
7486 Argument 1 -- the newtype to get a code for
7487 (Optional)
7488 Argument 2 -- its primtype, as a check
7489 Returns -- a type code
7490
7491 Example:  <TYPE-C MYLIST LIST>
7492 makes or gets a type code for my newtype
7493 \f
7494 TYPE-W:   Get a type word for pure RSUBR use
7495
7496 Object-type:  SUBR
7497
7498 Category:  TYPE-DEFINITION
7499
7500 Reference:  NEWTYPE, TYPE-C
7501
7502
7503 Argument:
7504
7505   Template:  #DECL ("VALUE" TYPE-W ATOM "OPTIONAL"
7506                     ATOM <PRIMTYPE WORD>)
7507
7508 Argument 1 -- name of newtype
7509 (Optional)
7510 Argument 2 -- primtype thereof, as a check
7511 Argument 3 -- right half to include in result
7512 Returns -- a type word
7513
7514 Example:  <TYPE-W MYLIST LIST 69>
7515 a type word for NEWTYPE MYLIST
7516 \f
7517 TYPE:     Return the type of an object
7518
7519 Object-type:  SUBR
7520
7521 Category:  TYPE
7522
7523 Reference:  UTYPE, TYPE?, PRIMTYPE, TYPEPRIM
7524
7525      TYPE is applied to any MUDDLE object to return an ATOM which is
7526 the name of the type of that object.  PRIMTYPE, which is similar,
7527 returns the primitive type of the object given.  TYPEPRIM returns the
7528 primitive type given the name of the type.
7529
7530 Argument:
7531
7532   Template:  #DECL ("VALUE" ATOM ANY)
7533
7534 Argument 1 -- Any MUDDLE object.
7535 Returns -- ATOM, the name of the type of the argument.
7536
7537 Example:  <TYPE TYPE>
7538           ATOM
7539           <TYPE "Comments on example">
7540           STRING
7541
7542 TYPE?, which checks to see if its argument is one of a series of
7543 types, is often used instead of TYPE in conditionals.
7544 \f
7545 TYPE?:    Is an object one of a group of types?
7546
7547 Object-type:  SUBR
7548
7549 Category:  PREDICATE, TYPE
7550
7551 Reference:  TYPE
7552
7553      TYPE? takes as arguments an object and at least one type name.
7554 If the object is one of the types given, that type is returned.  If it
7555 is not, returns FALSE.  TYPE? is essentially the same as MEMQing the
7556 TYPE of the object in a list of types, but is syntactically clearer
7557 and better understood by the compiler.
7558
7559 Argument:
7560
7561   Template:  #DECL ("VALUE" <OR FALSE ATOM> ANY "TUPLE"
7562                     <TUPLE ATOM [REST ATOM]>)
7563
7564 Argument 1 -- Any MUDDLE object.
7565 Tuple of arguments -- Any number (at least one, though) type names.
7566 Returns -- The type if it is in the tuple, or FALSE if it is not.
7567
7568 Example:  <TYPE? 1 FIX FLOAT WORD>
7569           FIX
7570 Will take any number of type names.
7571 \f
7572 TYPEPRIM: Return the primitive type of a type
7573
7574 Object-type:  SUBR
7575
7576 Category:  TYPE
7577
7578 Reference:  UTYPE, TYPE?, PRIMTYPE, TYPE
7579
7580      TYPEPRIM returns the primitive type given the name of the type
7581 of a MUDDLE object.  It is thus different from PRIMTYPE, which takes
7582 the object itself.
7583
7584 Argument:
7585
7586   Template:  #DECL ("VALUE" ATOM ATOM)
7587
7588 Argument 1 -- An ATOM which is the name of a type.
7589 Returns -- ATOM, the name of the primitive type of the argument.
7590
7591 Example:  <TYPE 1>
7592           FIX
7593           <PRIMTYPE 1>
7594           WORD
7595           <TYPEPRIM FIX>
7596           WORD
7597 Illustrates difference between PRIMTYPE and TYPEPRIM.
7598 \f
7599 UNAME:    Return the User-name of the MUDDLE
7600
7601 Object-type:  SUBR
7602
7603 Category:  SYSTEM
7604
7605      Returns the UNAME, or login-name of the MUDDLE.  This is the
7606 name under which the person running the MUDDLE logged in.  It is also
7607 one of the names of the MUDDLE job.
7608
7609 Argument:
7610
7611   Template:  #DECL ("VALUE" STRING)
7612
7613 Returns -- A STRING giving the UNAME of the job.
7614
7615 Example:  <UNAME>
7616 Only possible example.
7617 \f
7618 UNASSIGN: Removes the local value of an ATOM
7619
7620 Object-type:  SUBR
7621
7622 Category:  IDENTIFIER
7623
7624 Reference:  LVAL, ASSIGNED?
7625
7626      UNASSIGN removes the local value of an ATOM.  After an ATOM
7627 has been UNASSIGNED, LVAL of it will cause an error, and ASSIGNED?
7628 of it will return FALSE.
7629
7630 Argument:
7631
7632   Template:  #DECL ("VALUE" ATOM ATOM "OPTIONAL"
7633                     <OR ENVIRONMENT ACTIVATION FRAME PROCESS>)
7634
7635 Argument 1 -- The ATOM to flush the LVAL of.
7636 (Optional)
7637 Argument 2 -- the environment of the LVAL
7638 Returns -- The ATOM you just UNASSIGNed.
7639
7640 Example:  <UNASSIGN SNM>
7641           SNM
7642 if it's giving you trouble
7643 \f
7644 UNMANIFEST: Declare the global value of an ATOM to no longer be a constant
7645
7646 Object-type:  SUBR
7647
7648 Category:  DATA-HANDLING
7649
7650 Reference:  MANIFEST, MANIFEST?, GDECL
7651
7652      UNMANIFEST declares that the current global value of an ATOM is
7653 no longer a constant.  Generally a ATOM passed to UNMANIFEST will have
7654 previously been passed to MANIFEST.
7655      UNMANIFEST is generally used to remove the restriction on changing
7656 an MANIFEST variable so that it CAN be changed.
7657
7658 Argument:
7659
7660   Template:  #DECL ("VALUE" 'T "TUPLE" <TUPLE [REST ATOM]>)
7661
7662 Tuple of arguments -- ATOMs whose GVALs are no longer constants.
7663 Returns -- T.
7664
7665 Example:  <SETG A 1>
7666           <SETG B 2>
7667           <MANIFEST A B>
7668 ...
7669           <UNMANIFEST A>
7670           <SETG A 4>
7671 Most common use of UNMANIFEST.
7672 \f
7673 UNPARSE:  Recreate the STRING representation of a MUDDLE object
7674
7675 Object-type:  SUBR
7676
7677 Category:  DATA-HANDLING
7678
7679 Reference:  PARSE, LPARSE
7680
7681      UNPARSE create a string representation of a MUDDLE object, just
7682 like printing into a string instead of a channel.
7683
7684 Argument:
7685
7686   Template:  #DECL ("VALUE" STRING ANY "OPTIONAL" FIX)
7687
7688 Argument 1 -- ANY, object to be 'printed' into a string.
7689 (Optional)
7690 Argument 2 -- radix for FIX conversion, default ten
7691 Returns -- A STRING, the unparsed object.
7692
7693 Example:  <PARSE <UNPARSE (1 2 3 4)>>
7694 This is one way of creating a non-shared copy of a structure.
7695
7696 Object-type:  FSUBR
7697
7698 Category:  PROGRAM-CONTROL
7699
7700      UNWIND is an FSUBR that takes two forms.  It EVALs the first
7701 one, and, if the EVAL returns normally, the value of that EVAL is the
7702 value of UNWIND.  If, however, during the EVAL a non-local return
7703 attempts to return beyond the UNWIND in the stack, then the second
7704 form is EVALed, its value is ignored, and the non-local return is
7705 completed.  The second form is evaluated in the environment that was
7706 present when the call to UNWIND was made.
7707      This facility is useful for cleaning up data bases that are in
7708 inconsistent states and closing temporary channels that may be left
7709 around.  FLOAD sets up an UNWIND to close its CHANNEL if the user
7710 attempts to ERRET without finishing the FLOAD.
7711
7712 Argument:
7713
7714   Template:  #DECL ("VALUE" ANY "ARGS" <LIST ANY ANY>)
7715
7716 Argument 1 -- A form to be EVALed.
7717 Argument 2 -- A form to EVAL if a non-local return beyond the UNWIND
7718         happens.
7719 Returns -- The result of EVALing argument 1 (only local return that
7720         can happen).
7721
7722 Example:  <DEFINE FOO ACT ("AUX" (C
7723                                                     <OPEN "READ"
7724                                                           "FOOBAR">))
7725                   <UNWIND <PROG () "...&..."> <CLOSE .C>>>
7726
7727 Channel C will be closed if the PROG returns non-locally, as from
7728 ACT, for example.
7729 \f
7730 UTYPE:    Return the Uniform type of a UVECTOR
7731
7732 Object-type:  SUBR
7733
7734 Category:  TYPE
7735
7736 Reference:  UVECTOR, CHUTYPE
7737
7738      UTYPE returns the name of the uniform type of a UVECTOR.  This
7739 is the type of all objects in the UVECTOR.  It may be changed by using
7740 CHUTYPE (within limits).
7741
7742 Argument:
7743
7744   Template:  #DECL ("VALUE" ATOM <PRIMTYPE UVECTOR>)
7745
7746 Argument 1 -- A UVECTOR
7747 Returns -- An ATOM, which is the name of the UVECTOR's uniform type.
7748
7749 Example:  <UTYPE ![1 2 3 4!]>
7750           FIX
7751 Allows you to get the utype without accessing any individual element.
7752 \f
7753 UVECTOR:  Create a UVECTOR with explicit elements
7754
7755 Object-type:  SUBR
7756
7757 Category:  DATA-HANDLING
7758
7759 Reference:  IUVECTOR
7760
7761      UVECTOR creates a uvector with explicit elements.  Note that all
7762 of these elements must be of the same type, else ERROR.  UVECTOR is
7763 different from an explicit usage of excl-[, because in such usage all
7764 the elements must be the same when read in -- they are already a
7765 UVECTOR before evaluation.
7766
7767 Argument:
7768
7769   Template:  #DECL ("VALUE" UVECTOR "TUPLE" <TUPLE [REST ANY]>)
7770
7771 Tuple of arguments -- ANY, the elements must all be of same type, and
7772         can't be strings, LOCDs, or on the stack.
7773 Returns -- A new UVECTOR.
7774
7775 Example:  <UVECTOR 1 2 3>
7776 Equivalent to ![1 2 3]
7777           <UVECTOR 1 .FOO .BAR>
7778 Not equivalent to ![1 .FOO .BAR!], which is illegal
7779 \f
7780 VALID-TYPE?: Is an ATOM the name of a type?
7781
7782 Object-type:  SUBR
7783
7784 Category:  TYPE-DEFINITION, PREDICATE
7785
7786 Reference:  NEWTYPE
7787
7788 VALID-TYPE? returns #FALSE () if its argument is not the name of a
7789 TYPE, and TYPE-C of its argument if it is.  It is much more efficient
7790 than <MEMQ .arg <ALLTYPES>> .
7791
7792 Argument:
7793
7794   Template:  #DECL ("VALUE" <OR TYPE-C FALSE> ATOM)
7795
7796 Argument 1 -- an ATOM that might be the name of a TYPE
7797 Returns -- whether or not it really is
7798
7799 Example:  <VALID-TYPE? FOO>
7800           #FALSE ()
7801           <NEWTYPE FOO CHARACTER>
7802           FOO
7803           <VALID-TYPE? FOO>
7804 now returns %<TYPE-C FOO CHARACTER>
7805 \f
7806 VALRET:   Returns a string to MUDDLE's superior
7807
7808 Object-type:  SUBR
7809
7810 Category:  ENVIRONMENT
7811
7812 Reference:  LOGOUT, QUIT
7813
7814      VALRET returns a string to the MUDDLE's superior.  This is
7815 usually only useful if the superior is a MONIT or DDT (which are the
7816 two normal superiors on ITS).  VALRET's can be used to execute
7817 commands in DDT and then return to MUDDLE, but because they are
7818 limited to use on ITS, it is untasteful to use VALRET where other
7819 means would suffice.
7820
7821 Argument:
7822
7823   Template:  #DECL ("VALUE" ANY STRING)
7824
7825 Argument 1 -- A STRING to return to MUDDLE's superior.
7826 Returns -- ANY.
7827
7828 Example:  <VALRET "\17..SENDRP/-1
7829 70/\e2Q
7830 :VP
7831 ">
7832
7833 This example is a VALRET string that will cause DDT to stop printout
7834 of unsolicited messages.
7835 \f
7836 VALUE:    Return the local or else the global value of an atom
7837
7838 Object-type:  SUBR
7839
7840 Category:  IDENTIFIER
7841
7842 Reference:  LVAL, GVAL
7843
7844         If its argument has a local value (in a given environment),
7845 VALUE returns the value; else, if it has a global value, returns that;
7846 else error.
7847
7848 Argument:
7849
7850   Template:  #DECL ("VALUE" ANY ATOM "OPTIONAL"
7851                     <OR ENVIRONMENT ACTIVATION FRAME PROCESS>)
7852
7853 Argument 1 -- the atom whose value to get
7854 (Optional)
7855 Argument 2 -- the environment to look for a local value in
7856 Returns -- local or else global value
7857
7858 Example:  <VALUE SNM>
7859 default disk directory for I/O
7860 \f
7861 VECTOR:   Create a VECTOR with explicit elements
7862
7863 Object-type:  SUBR
7864
7865 Category:  DATA-HANDLING
7866
7867 Reference:  IVECTOR
7868
7869      VECTOR creates a vector with explicit elements.  It is the
7870 same as enclosing the arguments to VECTOR in [ and ].
7871
7872 Argument:
7873
7874   Template:  #DECL ("VALUE" VECTOR "TUPLE" <TUPLE [REST ANY]>)
7875
7876 Tuple of arguments -- ANY, the elements
7877 Returns -- A new VECTOR.
7878
7879 Example:  <VECTOR 1 2 3>
7880 equivalent to [1 2 3]
7881 \f
7882 XORB:     Bitwise logical Exclusive OR
7883
7884 Object-type:  SUBR
7885
7886 Category:  ARITHMETIC
7887
7888 Reference:  EQVB, ORB, ANDB
7889
7890      XORB takes any number of objects of Primtype WORD, and returns
7891 a WORD containing the bitwise logical exclusive OR of the arguments.
7892
7893 Argument:
7894
7895   Template:  #DECL ("VALUE" WORD
7896                     "TUPLE" <TUPLE [REST <PRIMTYPE WORD>]>)
7897
7898 Tuple of arguments -- Objects of primtype WORD to be XORed together.
7899 Returns -- A WORD containing the bitwise XOR of the arguments.
7900
7901 Example:  <XORB #WORD *000000000001*
7902                 #WORD *000000000001*
7903                 #WORD *000000042263*>
7904           #WORD *000000042263*
7905 Primarily useful for getting fingers directly in the bits.
7906 \f