summaryrefslogtreecommitdiff
path: root/support/mumble.txt
blob: 0ca2f405b667028707b949cc04164b4b5d64f865 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
Syntax
------

(quote x)

(function name)
  You must use this to reference a global function, as in CL.  (There
  isn't a local function namespace.)

(lambda lambda-list . body)
  Equivalent to #'(lambda ...) in Common Lisp.
  The lambda-list can be dotted, as in Scheme.  CL lambda-list keywords
  are not supported.

function call
  Order of evaluation is unspecified, as in Scheme.
  You have to use FUNCALL if the function is bound with let.

(funcall function . args)
  As in Common Lisp, but might be a macro.  (The function is guaranteed
  to be a true function, not a symbol.)

(apply procedure . args)
  As in Common Lisp/Scheme.

(map procedure . lists)
  As in Scheme.  Equivalent to MAPCAR in CL.

(for-each procedure . lists)
  As in Scheme.  Equivalent to MAPC in CL.

(every procedure . lists)
(some procedure . lists)
(notany procedure . lists)
(notevery procedure . lists)
  As in CL, but only work on lists.

(procedure? object)
  As in Scheme, but can return an arbitrary truth value instead of just #t.
  Note that we never use symbols or quoted lambda expressions as functions.

(if test then . maybe-else)
(when test . body)
(unless test . body)

(cond . tests)
  As in Scheme, but the = syntax isn't supported.  When no test is true, the
  result is undefined.

(case value . cases)
  As in Scheme.
  Stylistically, use this only when the case labels are symbols.

(and . expressions)
(or  . expressions)

(not value)
  As in Scheme but can return an arbitrary truth value instead of #t.

(set! variable value)
  As in Scheme; this doesn't return a useful value.  Use setf instead.

(setf place value)
  Similar to SETF in Common Lisp.  Returns value.
  See define-setf below.  Places that are macro calls are expanded
  if they don't have their own setter.
  Here is a list of the built-in setters:
    dynamic
    car
    cdr
    list-ref
    string-ref
    vector-ref
    table-entry

(let    bindings . body)
(let*   bindings . body)
(letrec bindings . body)
  Note that each binding clause must be a list of the form (var init);
  you can't just supply var or (var) as in Common Lisp.  Also remember
  that the order of evaluation for the init-forms is not specified for
  let/letrec.
  The Scheme named LET construct is not supported.

(flet   bindings . body)
(labels bindings . body)
  As in Common Lisp.

(dynamic-let bindings . body)
(dynamic name)
  As in Eulisp.  Dynamic-let is equivalent to bind in T, or LET in
  Common Lisp with all of the variables declared special.  As a matter
  of style, use dynamic to reference the value rather than just the name.

(begin . body)
  Like PROGN in Common Lisp.

(block name . body)
(return-from name result)
  The intersection of the Eulisp and Common Lisp definitions.  The "name" 
  may be bound as a lexical variable, but you should only refer to it
  inside a return-from.
  Don't depend on named functions (etc) establishing implicit blocks,
  as they do in CL.

(do bindings-and-steppers (end-test . results) . body)
  As in Scheme.  It doesn't necessarily establish an implicit BLOCK 
  as in CL so you can't RETURN from the loop.

(dolist (variable init . maybe-result) . body)
(dotimes (variable init . maybe-result) . body)
  As in CL, except you can't RETURN from the loop.

(values . values)
(multiple-value-bind variables values-expression . body)
  As in Common Lisp, except that the values-expression must explicitly
  return multiple values.

(let/cc variable . body)
  As in EuLisp.  This is the same as catch in T.  The continuation
  has dynamic extent within the body.
  You call the continuation with an arbitrary number of arguments, which
  are the multiple values to be returned.

(unwind-protect protected-form . body)

(declare ...)
  Similar to Common Lisp declare.  Declarations are allowed only in the
  standard places that Common Lisp permits (in particular, at the
  beginning of binding forms).  For now, only the following declarations
  are permitted:

  (ignore . variables)
  (ignorable . variables)
  (type type-spec . variables)  -- see info on type-specs below.




Definitions
-----------

(define pattern . value)
  As in Scheme.

(define-integrable pattern . value)
  Like DEFINE, but also tells the compiler to try to inline the value.

(define-syntax (name . lambda-list) . body)
  Similar to the equivalent T functionality.  The lambda-list does not
  support destructuring, as does Common Lisp's DEFMACRO.
  The macro definition is made both when the file is loaded and when it
  is compiled.

(define-local-syntax (name . lambda-list) . body)
  Again, similar to the T functionality.  In Common Lisp, equivalent to
  a DEFMACRO wrapped in (eval-when (compile) ...).  

(define-setf getter-name setter-name)
  Similar to the short form of DEFSETF in Common Lisp, except that the
  calling convention for the setter differs:  the value is passed as the
  first argument rather than as the last.  The setter must return this
  value.

(predefine pattern)
  This is a forward definition for a function or variable.  It doesn't
  actually make a definition; its purpose is to try to get rid of compiler
  warnings about calls to functions that haven't been defined yet.  It can
  be a no-op if the underlying Lisp system doesn't provide any way to do
  this.

(redefine pattern . value)
  Like DEFINE, but hints to the compiler not to complain if this 
  function/variable was previously defined somewhere else.

(redefine-syntax (name . lambda-list) . body)
  Like DEFINE-SYNTAX, but hints to the compiler not to complain if this
  macro was previously defined somewhere else.


Equivalence
-----------

(eq? x1 x2)
(eqv? x1 x2)
(equal? x1 x2)
  As in Scheme but can return an arbitrary truth value instead of #t.
  Note that equal? is not the same as EQUAL in CL because it descends vectors.
  eqv? is different from the T equiv? because it doesn't descent strings.


Lists
-----

(pair? x)
  As in Scheme but can return an arbitrary truth value instead of #t.

(cons x y)
(list . values)
(make-list length . maybe-init)

(cxxxxr x)

(null? x)
(list? x)
  As in Scheme but can return an arbitrary truth value instead of #t.
  Note that this is a check for a proper (null-terminated) list, not
  like LISTP in CL.

(length x)
(append list . more-lists)
(nconc list . more-lists)

(reverse x)
(nreverse x)

(list-tail list n)
  Like NTHCDR in Common Lisp.

(list-ref list n)
  Like NTH in Common Lisp.

(last list)
(butlast list)
  As in Common Lisp.

(memq object list)
(memv object list)
(member object list)

(assq object list)
(assv object list)
(assoc object list)

(push item place)
(pop place)
  As in Common Lisp.

(list-copy list)


Symbols
-------

(symbol? object)
(symbol->string object)
(string->symbol object)
(gensym . maybe-prefix)
(gensym? object)

(symbol-append . symbols)


Characters
----------

(char? object)
  As in Scheme, but can return an arbitrary truth value instead of just #t.  

(char=? c1 c2)
(char<? c1 c2)
(char>? c1 c2)
(char<=? c1 c2)
(char>=? c1 c2)
  As in Scheme, except that they can return an arbitrary truth value
  instead of just #t.

(char-ci=? c1 c2)
(char-ci<? c1 c2)
(char-ci>? c1 c2)
(char-ci<=? c1 c2)
(char-ci>=? c1 c2)
  As in Scheme, except that they can return an arbitrary truth value
  instead of just #t.

(char-alphabetic? c)
(char-numeric? c)
(char-whitespace? c)
(char-upper-case? c)
(char-lower-case? c)

(char->integer c)
(integer->char n)

(char-upcase c)
(char-downcase c)

(char-name c)
  As in Common Lisp.

(char->digit c . maybe-radix)
  Returns nil or the "weight" of the character as a fixnum in the given
  radix (defaults to 10).


Strings
-------

(string? object)
  As in Scheme, but can return an arbitrary truth value instead of just #t.

(make-string length . maybe-init)

(string char . more-chars)

(string-length string)
(string-ref string index)

(string=? s1 s2)
(string<? s1 s2)
(string>? s1 s2)
(string<=? s1 s2)
(string>=? s1 s2)
  As in Scheme, but can return an arbitrary truth value instead of just #t.

(string-ci=? s1 s2)
(string-ci<? s1 s2)
(string-ci>? s1 s2)
(string-ci<=? s1 s2)
(string-ci>=? s1 s2)
  As in Scheme, but can return an arbitrary truth value instead of just #t.

(substring string start end)
(string-append string . more-strings)

(string->list string)
(list->string list)

(string-copy string)

(string-upcase string)
(string-downcase string)


Vectors
-------

(vector? object)
  As in Scheme, but can return an arbitrary truth value instead of just #t.

(make-vector length . maybe-init)
(vector object . more-objects)

(vector-length vector)
(vector-ref vector index)
(vector->list vector)
(list->vector list)

(vector-copy vector)


Numbers
-------

(number? object)
  As in Scheme, but can return an arbitrary truth value instead of just #t.

(integer? object)
(rational? object)
(float? object)
  These test the representation of a number, not its mathematical 
  properties.  They're equivalent to the CL integerp, rationalp, and floatp
  predicates.  We ignore complex numbers for now.

(exact->inexact number)
  Convert an exact-rational to a float.

(= x1 x2)
(< x1 x2)
(> x1 x2)
(<= x1 x2)
(>= x1 x2)
  As in Scheme, except they can return an arbitrary truth value.
  They're restricted to being binary operators because that's all
  that's supported in T.

(zero? x)
(positive? x)
(negative? x)
  As in Scheme, except they can return an arbitrary truth value.

(min number . more-numbers)
(max number . more-numbers)

(+ . numbers)
(* . numbers)
(- n1 . more-numbers)
(/ n1 . more-numbers)
  As in Scheme.

(quotient n1 n2)
(remainder n1 n2)
(modulo n1 n2)
  quotient rounds towards zero.
  remainder has the sign of the second argument, modulo has the sign of
  the first argument.

(floor x)
(ceiling x)
(truncate x)
(round x)
  As in Scheme.  These return a number of the same type as the argument.

(floor->exact x)
(ceiling->exact x)
(truncate->exact x)
(round->exact x)
  Like the above, but return an exact-integer result.  Borrowed from
  MIT Scheme.

(1+ n)
(1- n)
(incf place . maybe-delta)
(decf place . maybe-delta)
  As in Common Lisp.

(number->string number . maybe-radix)
(string->number string . maybe-radix)
  As in Scheme.

(expt base power)
  As in Common Lisp.  [our only use is when both args are integers]


Tables
------

(table? object)
(make-table)
(table-entry table key)
(table-for-each proc table)
(copy-table table)
  More or less as in T.  For now we only bother with tables that use
  eq? as the comparison function -- mostly symbols are used as keys.
 

I/O
---

(call-with-input-file string proc)
(call-with-output-file string proc)
  As in Scheme.  The proc is called with one argument, the port.

(call-with-input-string string proc)
(call-with-output-string proc)
  Similar, but for reading/writing to a string stream string.
  Call-with-output-string returns the string.

(input-port? object)
(output-port? object)
  As in Scheme, but can return an arbitrary truth value.

(current-input-port)
(current-output-port)

(open-input-file filename)
(open-output-file filename)

(close-input-port port)
(close-output-port port)

(read . maybe-port)
(read-char . maybe-port)
(peek-char . maybe-port)
(read-line . maybe-port)

(eof-object? object)


Printer
-------

(internal-write object port)
(internal-output-width port)
(internal-output-position port)
(internal-write-char char port)
(internal-write-string string port start end)
(internal-newline port)
(internal-fresh-line port)
(internal-finish-output port)
(internal-force-output port)
(internal-clear-output port)
(internal-write-to-string object)
(internal-warning string)
(internal-error string)
  These are all internal hooks.  Don't use them directly if you can
  avoid it.

(write object . maybe-stream)
(print object . maybe-stream)
(prin1 object . maybe-stream)
(princ object . maybe-stream)
(pprint object . maybe-stream)
(prin1-to-string object)
(princ-to-string object)
(write-char char . maybe-stream)
(write-string string . maybe-stream-start-end)
(write-line string . maybe-stream-start-end)
(terpri . maybe-stream)
(fresh-line . maybe-stream)
(finish-output . maybe-stream)
(force-output . maybe-stream)
(clear-output . maybe-stream)
  These are the standard Common Lisp print functions.  All of them
  accept either a port or an XP stream as a stream argument.

(display object . maybe-stream)
  Same as princ; for Scheme compatibility.
(newline object . maybe-stream)
  Same as terpri; for Scheme compatibility.


*print-escape*
*print-shared*
*print-circle*
*print-pretty*
*print-level*
*print-length*
  These are the standard Common Lisp printer control variables.  The
  functions listed above obey them.

*print-base*
*print-radix*
*print-case*
*print-readably*
  These are more standard Common Lisp printer control variables, but
  support for them hasn't been implemented yet.  Maybe some day.

*print-dispatch*
  This is the hook for user customization of the printer.  Its value is a 
  function that is passed an object as an argument, and returns another
  function that takes a stream and the object as arguments.

*print-structure*
  If true, use standard structure printing syntax (overriding any special
  print function for the structure type).

*print-structure-slots*
  If true, recursively print structure slots when using standard structure
  printing syntax; otherwise just print the structure type name.


(standard-print-dispatch object)
  This function is the initial value of *print-dispatch*.

*print-right-margin*
*print-miser-width*
*print-lines*
*default-right-margin*
*last-abbreviated-printing*
  These are the XP pretty-printer control variables.  For more information
  about the pretty-printer, read the XP document.

(pprint-newline kind . maybe-stream)
  The kind argument can be one of LINEAR, FILL, MISER, or MANDATORY.

(pprint-logical-block (stream-symbol list . more-options) . body)
  This is a macro.  The body should contain code for printing a logical
  block to the stream stream-symbol.

  The format of the options is (stream-symbol list prefix suffix per-line?).
  
  The list argument can be used with the pprint-pop macro.

  The prefix is a string that is printed as the initial prefix of the logical
  block.  If per-line? is true, then the prefix is printed on every line.
  The suffix is a string that is printed at the end of the logical block.

  You can use this macro even when not pretty-printing, to get support
  for *print-length* and *print-level*.  In that case, you should have
  the body forms put out only a minimal amount of whitespace.

(pprint-pop)
  Returns the next item from the list specified to an enclosing 
  pprint-logical-block.  Checks for circular list tails and *print-length*
  abbreviation.

(pprint-exit-if-list-exhausted)
  Can be used inside pprint-logical-block to see if the list is empty.
  Causes the block to be exited if so.

(pprint-indent relative-to n . maybe-stream)
  Specify the indentation level to use for a logical block.
  The relative-to argument can be either BLOCK or CURRENT.

(pprint-tab kind colnum colinc . maybe-stream)
  Specify tabbing.  The kind argument can be one of LINE, SECTION,
  LINE-RELATIVE, or SECTION-RELATIVE.
  
(pprint-fill stream list . maybe-colon-atsign)
(pprint-linear stream list . maybe-colon-atsign)
(pprint-tabular stream list . maybe-colon-atsign-tabsize)
  Pretty-print list to the stream in the given style.
  

(format stream string-or-fn . args)
  The standard Common Lisp format, except that some of the more esoteric
  directives are unimplemented.  (Specifically, watch out for specifying
  field widths or using # or V parameters; most of the numeric formatting
  options are unimplemented, as are complicated directives like ~{...~}.)

  The stream parameter can be #f to output to a string, or #t to output
  to the (current-output-port).

  The string-or-fn argument can be a function as well as a string containing
  embedded directives.  The function is applied to the stream and the args.

(warning string-or-fn . args)
(error string-or-fn . args)



System Interface
----------------

(macroexpand-1 form . maybe-env)
(macroexpand form . maybe-env)
  As in Common Lisp.  Since we don't have lexical macros and don't allow
  syntax to be shadowed by local bindings, you can omit the environment 
  argument.  These functions are provided mostly for debugging purposes.

(eval form . maybe-compile)
  As in Common Lisp.  If the optional argument is supplied and is true,
  try to compile the code in memory, not interpret it.

(load filename)

*code-quality*
  A number between 0 and 3.  0 = minimal compilation, 1 = for debugging,
  2 = low safety, high speed, fast compilation, 3 = go all out.

(compile-file source-filename . maybe-binary-filename)

(with-compilation-unit options . forms)
  This is the ANSI CL macro.  We don't use any options.

(filename-place filename)
(filename-name filename)
(filename-type filename)
  We use a rather simplistic file system model.  Filenames are strings
  with place (or directory), name, and type components.  These functions
  pick apart filename strings.  You shouldn't have to mess with string 
  operations on the components directly.  

(assemble-filename place-filename name-filename type-filename)
  Build a new filename by combining the appropriate parts of the argument
  filenames.

source-file-type
binary-file-type
  These constants hold appropriate default types for source and
  compiled files.  By convention, source-file-type is ".scm" but
  the binary-file-type depends on the underlying Lisp system.

(file-exists? filename)
  Returns true if the file exists.

(file-write-date filename)
(current-date)
  Dates are represented as integers relative to an arbitrary base.  These
  functions are mostly useful for recording timestamps.

(get-run-time)
  Return run time as a floating-point number relative to an arbitrary base.
  Useful for doing timings.

(getenv name)
  Explicitly expand an environment variable.  (Environment variables that
  appear as filename prefixes are expanded automagically by the functions 
  that open files.)

(cd filename)
  Change the current directory.


(exit)
  Go away.


Reader Support
--------------

' => quote
` => backquote; also , and ,@
#t and #f


Random Stuff
------------

lisp-implementation-name
  returns a string identifying the underlying lisp implementation; e.g.
  "lucid", "t", etc.

(identify-system)
  return a longer string indentifying the lisp version and machine type.

left-to-right-evaluation
  True if the underlying Lisp always evaluates function arguments
  left-to-right; false otherwise.

(gc-messages onoff)
  Turn garbage collection messages on/off, if possible.

(identity x)
  The identity function.



Type specifiers
---------------

t
procedure
pair
null
list, (list element-type)
symbol
char
string
vector
number
integer
rational
float
fixnum, int
table, (table key-type value-type)
(enum . values)
(tuple . component-types)
bool
alist, (alist key-type value-type)
(maybe type)
struct
type-descriptor
slot-descriptor
  These are the standard type specifiers.

the
  As in Common Lisp.
subtype?
  Equivalent to CL subtypep
is-type?
  Equivalent to CL typep
typecase
  As in Common Lisp, also recognizes "else" clause.
  


Structures
----------

(struct? object)
  Returns true if the object is a struct.
(struct-type-descriptor object)
  Returns the type descriptor of a struct object.

name, slots, parent-type, printer
  Slots of type-descriptor object.

(td-name td)
(td-slots td)
(td-parent-type td)
(td-printer td)
  Accessors for type-descriptors.

name, type, default, getter
  Slots of slot-descriptor object.

(sd-name sd)
(sd-type sd)
(sd-default sd)
(sd-getter sd)
  Accessors for slot-descriptors.
(sd-getter-function sd)
  Returns a function which can be used to access a slot (as opposed to
  the symbol that names the function).

(lookup-type-descriptor type-name)
(lookup-slot-descriptor type-name slot-name)
  Name to descriptor mappings.


(make type . initializers)
  The type must name a struct type; it is not evaluated.
  The initializers are of the form (slot-name value-form).

(struct-slot type slot object)
  Generalized slot access.  Type and slot are symbols.  If both are
  quoted, can be used with SETF.

(with-slots type slot-names object . body)
  Binds the specified slots of object to local variables with the
  same names.  Bindings are read-only.  Type is not evaluated.

(update-slots type object . initializers)
  Modifies the slots of object.  Syntax of initializers is as for make.
  Type is not evaluated.

(define-struct name
  (include parent-type-name)
  (type-template subtype-of-type-descriptor)
  (prefix prefix-symbol)
  (predicate predicate-name)
  (slots
    (slot-name
      (type type)
      (default init-form)
      (bit #t)
      (read-only? #t)
      (uninitialized? #t))
    ...))

  Defines name as a subtype of struct with the given slots.
  All fields are optional.

  Include specifies the immediate supertype.  All accessors on the supertype
  work on the newly defined type.  It defaults to struct.

  Type-template specifies the metaclass.  It can be used to attach 
  additional information to the type descriptor.  It defaults to 
  type-descriptor.

  Prefix can be used to specify an alternate prefix for accessors.  The
  default is name-.

  Predicate can be used to create a predicate function.  The default is
  not to create one.

  If no default is specified for a slot, it's expected to have an
  explicit initializer supplied with MAKE.  You'll get a compilation
  warning otherwise, unless you specify the uninitialized? option instead.

  Bit is a hint for optimizing internal representation.

  Read-only? says not to create a SETFer for the slot.


(define-struct-printer struct-name printer-function)
  Specifies a printer function to use when *print-structure* is false.