PageRenderTime 38ms CodeModel.GetById 2ms app.highlight 16ms RepoModel.GetById 1ms app.codeStats 0ms

/help/arc.arc

http://github.com/alimoeeny/arc
Unknown | 987 lines | 746 code | 241 blank | 0 comment | 0 complexity | 06835b06e8e923f39b71ed5e8292048a MD5 | raw file
  1(mac doclist args
  2  `(= ,@(mappend (fn ((name doc)) `((help* ',name) ,doc))
  3                 (pair args))))
  4
  5; TODO: defs union addtem since {minutes,hours,days}-since defcache only
  6; positive len< len> or= hook defhook out fromdisk diskvar disktable todisk
  7
  8(doclist
  9  do
 10  " Evaluates each expression in sequence and returns the result of the
 11    last expression.
 12    See also [[do1]] [[after]] "
 13
 14  def
 15  " Defines a function with the given `name', `parms', and `body'.
 16    See also [[fn]] [[mac]] "
 17
 18  caar " Equivalent to (car (car xs)) "
 19  cadr " Equivalent to (car (cdr xs)) "
 20  cddr " Equivalent to (cdr (cdr xs)) "
 21  no " Returns `t' iff `x' is `nil'. "
 22
 23  acons
 24  " Determines if `x' is a `cons' cell or list.
 25    Unlike 'alist, this function will return nil if given an empty list
 26    See also [[atom]] [[alist]] [[dotted]] [[isa]] [[cons]] [[list]] "
 27
 28  atom
 29  " Determines if `x' is atomic.
 30    See also [[acons]] [[isa]] "
 31
 32  copylist
 33  " Makes a shallow copy of the list `xs'.
 34    See also [[list]] [[cons]] "
 35
 36  list
 37  " Creates a list from the given parameters.
 38    See also [[cons]] [[acons]] [[copylist]] "
 39
 40  idfn " Returns `x'; the identity function. "
 41
 42  map1
 43  " Return a sequence with function f applied to every element in sequence xs.
 44    See also [[map]] [[each]] [[mappend]] [[andmap]] [[ormap]] "
 45
 46  pair
 47  " Applies pairs of elements to the function `f'.
 48    See also [[tuples]] [[map]] "
 49
 50  mac
 51  " Defines a macro, a special function which transforms code.
 52    See also [[def]] "
 53
 54  and
 55  " Evaluates arguments till false is found else returns the last one.
 56    See also [[or]] [[aand]] [[andf]] [[nor]] "
 57
 58  assoc
 59  " Finds a (key value) pair in an associated list.
 60    See also [[alref]] [[listtab]] [[tablist]] "
 61
 62  alref
 63  " Get a value from a key in a associated list.
 64    See also [[assoc]] [[listtab]] [[tablist]] "
 65
 66  with
 67  " Assigns a set of local variables for the given `body'.
 68    Assignment is simultaneous.
 69    See also [[withs]] [[let]] [[fn]] [[do]] "
 70
 71  let
 72  " Assigns a local variable for the given `body'.
 73    See also [[with]] [[withs]] [[fn]] [[do]] "
 74
 75  withs
 76  " Assigns local variables for the given `body'.
 77    The assignments are made in the given order.
 78    See also [[with]] [[let]] [[fn]] [[do]] "
 79
 80  join
 81  " Joins all list arguments together.
 82    See also [[cons]] [[+]] "
 83
 84  rfn
 85  " Creates a function which calls itself as `name'.
 86    See also [[fn]] [[afn]] "
 87
 88  afn
 89  " Creates a function which calls itself with the name `self'.
 90    See also [[fn]] [[rfn]] [[aif]] [[awhen]] [[aand]] "
 91
 92  compose
 93  " Function composition; eg. ((compose x y z) a b c) == (x (y (z a b c)))
 94    Composes in functional position are transformed away by ac.
 95    Arc expands x:y:z into (compose x y z)
 96    See also [[complement]] "
 97
 98  complement
 99  " Function complement; eg. ((complement f) a b) == (no (f a b))
100    Complements in functional position are transformed away by ac.
101    Arc expands ~x into (complement x)
102    See also [[compose]] "
103
104  rev
105  " Reverses a copy of the list `xs'
106    See also [[copy]] [[copylist]] "
107
108  isnt
109  " Inverse of is.
110    See also [[no]] [[is]] "
111
112  w/uniq
113  " Assigns a set of variables to unique symbols.
114    Generally used in macros.
115    See also [[uniq]] "
116
117  or
118  " Computes arguments until one of them is true and returns that result.
119    See also [[and]] [[orf]] [[nor]] [[check]] "
120
121  alist
122  " Return true if argument is a possibly empty list
123    Unlike 'acons, this function returns t when given an empty list
124    See also [[atom]] [[acons]] [[dotted]] [[isa]] [[cons]] [[list]] "
125
126  in
127  " Returns true if the first argument is one of the other arguments.
128    See also [[some]] [[mem]] "
129
130  iso
131  " Isomorphic compare - compares structure (can be slow).
132    See also [[is]] "
133
134  when
135  " When `test' is true, do `body'.
136    See also [[unless]] [[if]] [[awhen]] "
137
138  unless
139  " When `test' is not true, do `body'.
140    See also [[when]] [[if]] [[no]] "
141
142  while
143  " While `test' is true, perform `body' in a loop.
144    See also [[until]] [[loop]] [[whilet]] [[whiler]] [[for]]
145    [[repeat]] [[drain]] "
146
147  empty
148  " Test to see if `seq' is an empty list or other sequence.
149    See also [[no]] [[acons]] [[len]] "
150
151  reclist
152  " Applies the function `f' on the sublists of `xs' until `f' returns true.
153    See also [[map]] "
154
155  recstring
156  " Applies the function `test' on indices of `s' until `test' returns true.
157    See also [[map]] [[reclist]] "
158
159  testify
160  " Turns `x' into a test. Functions are returned unchanged. Otherwise, returns
161    a function that tests whether its argument is `x'.
162    See also [[is]] "
163
164  some
165  " Determines if at least one element of `seq' satisfies `test'.
166    See also [[all]] [[mem]] [[in]] [[pos]] [[testify]] "
167
168  all
169  " Determines if all elements of `seq' satisfy `test'.
170    See also [[some]] [[testify]] "
171
172  mem
173  " Returns the sublist of `seq' whose first element satisfies `test'.
174    See also [[find]] [[some]] [[in]] [[testify]] "
175
176  find
177  " Returns the first element of `seq' that satisfies `test'.
178    See also [[mem]] [[some]] [[in]] [[testify]] "
179
180  isa
181  " Checks if x is of type y.
182    See also [[acons]] [[alist]] [[atom]] "
183
184  map
185  " Applies the elements of the sequences to the given function.
186    Returns a sequence containing the results of the function.
187    See also [[each]] [[map1]] [[mappend]] [[reduce]] "
188
189  mappend
190  " Applies the elements of the sequences to the given function.
191    Returns a sequence containing the concatenation of the results
192    of the function.
193    See also [[map]] [[join]] "
194
195  firstn
196  " Returns the first `n' elements of the given list `xs'.
197    See also [[cut]] [[nthcdr]] [[retrieve]] "
198
199  nthcdr
200  " Returns the sublist of `xs' starting on the `n'th element.
201    `n' is 0-based.
202    See also [[cut]] [[firstn]] "
203
204  tuples
205  " Returns a list of lists of the elements of `xs', grouped by `n'.
206    See also [[pair]] "
207
208  caris
209  " Determines if (car x) is `val'.
210    See also [[is]] [[car]] [[carif]] "
211
212  warn
213  " Displays a warning message on its arguments.
214    See also [[ero]] [[pr]] "
215
216  atomic
217  " Performs `body' atomically, blocking other threads.
218    See also [[atlet]] [[atwith]] [[atwiths]] "
219
220  atlet
221  " Performs a `let' atomically, blocking other threads.
222    See also [[atomic]] [[atwith]] [[atwiths]] "
223
224  atwith
225  " Performs a `with' atomically, blocking other threads.
226    See also [[atomic]] [[atlet]] [[atwiths]] "
227
228  atwiths
229  " Performs a `withs' atomically, blocking other threads.
230    See also [[atomic]] [[atlet]] [[atwith]] "
231
232  defset
233  " Defines a setter for the named form.
234    See also [[=]] "
235
236  =
237  " Assigns values to variables.
238    See also [[set]] [[wipe]] [[++]] [[--]] [[rotate]] [[defset]] "
239
240  loop
241  " First performs `start'; while `test' is true, performs `body' then
242    `update' in a loop.
243    See also [[while]] "
244
245  for
246  " Loops for the variable `v' from `init' to `max'.
247    See also [[repeat]] [[forlen]] "
248
249  repeat
250  " Repeats the `body' `n' times.
251    See also [[for]] [[forlen]] [[n-of]] "
252
253  walk
254  " Calls `func' on each element of `seq' for side-effects.
255    See also [[map]] [[each]] "
256
257  each
258  " Performs `body' for each element of the sequence returned by `expr',
259    with each element assigned to `var'.
260    See also [[walk]] [[forlen]] [[on]] [[map]] [[ontable]] "
261
262  cut
263  " Returns a subsequence of the given `seq'. If `end' is negative,
264    it's a 0-based index from the end of the string. For example,
265
266      arc> (cut \"abcde\" 1, -1)
267      \"bcd\"
268
269    See also [[firstn]] [[nthcdr]] [[split]] "
270
271  whilet
272  " While `test' is true, perform `body' in a loop.
273    The result of `test' is assigned to `var'.
274    See also [[while]] [[whiler]] [[drain]] "
275
276  last " Returns the last element of `seq'. "
277
278  rem
279  " Returns a copy of `seq' with elements that pass `test' removed.
280    See also [[keep]] [[pull]] "
281
282  keep
283  " Returns a copy of `seq' with elements that fail `test' removed.
284    See also [[rem]] [[pull]] [[trues]] "
285
286  trues
287  " Returns (map f xs) sans nils.
288    See also [[rem]] [[keep]] "
289
290  do1
291  " Performs the body in sequence, then returns the value of the
292    first expression.
293    See also [[do]] "
294
295  caselet
296  " Matches the result of `expr' to arguments until one matches.
297    The result of `expr' is assigned to `var'.
298    See also [[case]] [[if]] [[iflet]] "
299
300  case
301  " Matches the result of `expr' to arguments until one matches.
302    See also [[caselet]] [[if]] "
303
304  push
305  " Pushes the value `x' on the front of the list in `place'.
306    See also [[pop]] [[cons]] "
307
308  swap
309  " Swaps the values of the specified places.
310    See also [[rotate]] [[=]] "
311
312  rotate
313  " Rotates the values of the specified places, from right to left.
314    See also [[swap]] [[=]] "
315
316  pop
317  " Pops a value from the front of the list in `place'.
318    See also [[push]] [[car]] "
319
320  adjoin
321  " Returns a list with `x' in front of `xs', unless `test' returns true
322    for some element of `xs' when matched with `x'.
323    See also [[cons]] [[pushnew]] [[consif]] "
324
325  pushnew
326  " Pushes `x' into the front of the list in `place' unless it is
327    already in that list.
328    See also [[push]] [[adjoin]] [[cons]] [[consif]] "
329
330  pull
331  " Removes all elements that pass `test' from the list in `place'.
332    See also [[rem]] [[keep]] "
333
334  ++
335  " Increments `place' by the given increment `i' (defaults to 1).
336    See also [[--]] [[zap]] [[=]] "
337
338  --
339  " Decrements `place' by the given decrement `i' (defaults to 1).
340    See also [[++]] [[zap]] [[=]] "
341
342  zap
343  " Modifies `place' with the result of `op' on that `place'.
344    See also [[++]] [[--]] [[pull]] [[push]] [[pop]] [[=]]
345    [[set]] [[wipe]] "
346
347  pr
348  " Prints the arguments.
349    See also [[prn]] [[warn]] [[ero]] "
350
351  prn
352  " Prints the arguments followed by a newline.
353    See also [[pr]] [[warn]] [[ero]] "
354
355  wipe
356  " Sets each of the given places to nil.
357    See also [[set]] [[zap]] [[=]] "
358
359  set
360  " Sets each of the given places to t.
361    See also [[wipe]] [[zap]] [[=]] "
362
363  iflet
364  " Checks if `expr' is true, and if so, assigns it to `var' and
365    performs the `then' clause.
366    See also [[caselet]] [[whenlet]] [[if]] "
367
368  whenlet
369  " Checks if `expr' is true, and if so, assigns it to `var' and
370    performs the `body'.
371    See also [[caselet]] [[iflet]] [[when]] [[if]] "
372
373  aif
374  " Similar to `if' but assigns the result of 'expr' to the variable `it'.
375    See also [[if]] [[awhen]] [[aand]] [[afn]] "
376
377  awhen
378  " Similar to `when' but assigns the result of 'expr' to the variable `it'.
379    See also [[when]] [[aif]] [[aand]] [[afn]] "
380
381  aand
382  " Similar to `and' but assigns the previous expression to the variable `it'.
383    See also [[and]] [[aif]] [[awhen]] [[afn]] "
384
385  accum
386  " Collects or accumulates the values given to all calls to `accfn' within
387    `body' and returns a list of those values.  Order is preserved.
388    See also [[summing]] "
389
390  drain
391  " Repeatedly evaluates `expr' until it returns nil, then returns a list
392    of the true values.
393    See also [[while]] [[whiler]] [[whilet]] "
394
395  whiler
396  " Performs `body' while `expr' is not `endval', assigning the result of
397    `expr' to `var'.
398    See also [[while]] [[whilet]] [[drain]] "
399
400  consif
401  " Adds `x' to the front of the list `y' if `x' is true.
402    See also [[cons]] [[if]] [[adjoin]] [[conswhen]] "
403
404  string
405  " Creates a string from its arguments
406    See also [[sym]] "
407
408  flat
409  " Flattens a nested list.
410    See also [[list]] "
411
412  check
413  " Returns `x' if it passes `test', otherwise returns `alt'.
414    See also [[or]] "
415
416  pos
417  " Returns the position of the first element in `seq' that passes `test'.
418    See also [[some]] "
419
420  even
421  " Determines if a number is even. See also [[odd]] "
422
423  odd
424  " Determines if a number is odd. See also [[even]] "
425
426  after
427  " Ensures that the body is performed after the expression `x',
428    even if it fails.
429    See also [[do]]"
430
431  w/infile
432  " Opens the given file `name' for input, assigning the stream to `var'.
433    The stream is automatically closed on exit from the `body'.
434    See also [[w/outfile]] [[w/instring]] [[w/stdin]] [[w/socket]] "
435
436  w/outfile
437  " Opens the given file `name' for output, assigning the stream to `var'.
438    The stream is automatically closed on exit from the `body'.
439    See also [[w/infile]] [[w/appendfile]] [[w/outstring]] [[w/stdout]] "
440
441  w/instring
442  " Opens the given string `str' for input, assigning the stream to `var'.
443    The stream is automatically closed on exit from the `body'.
444    See also [[w/outstring]] [[fromstring]] [[w/infile]] [[w/stdin]]
445    [[w/socket]] "
446
447  w/socket
448  " Opens the port for listening, assigning the stream to `var'.
449    The stream is automatically closed on exit from the `body'.
450    See also [[w/infile]] [[w/instring]] [[w/stdin]] "
451
452  w/outstring
453  " Opens a string for output, assigning the stream to `var'.
454    The stream is automatically closed on exit from the `body'.
455    The contents of the string can be accessed via (inside `var')
456    See also [[w/instring]] [[tostring]] [[w/outfile]] [[w/stdout]] "
457
458  w/appendfile
459  " Opens a file `name' for append, assigning the stream to `var'.
460    The stream is automatically closed on exit from the `body'.
461    See also [[w/outfile]] [[w/infile]] "
462
463  w/stdout
464  " Opens the stream `str' for output; normal printed output from `body'
465    is redirected to the stream.
466    See also [[w/stdin]] [[w/outfile]] [[w/outstring]] "
467
468  w/stdin
469  " Opens the stream `str' for input; normal read input from `body'
470    is redirected from the stream.
471    See also [[w/stdout]] [[w/infile]] [[w/instring]] [[w/socket]] "
472
473  tostring
474  " Returns the printed standard output from `body' as a string.
475    See also [[fromstring]] [[w/stdout]] [[w/outstring]] "
476
477  fromstring
478  " Redirects read standard input to `body' from the given string `str'.
479    See also [[tostring]] [[w/stdin]] [[w/instring]] "
480
481  readstring1
482  " Reads a single expression from the string.
483    See also [[read]] "
484
485  read
486  " Reads a single expression from a string or stream.
487    See also [[readstring1]] [[readfile]] [[readfile1]] [[readall]] "
488
489  readfile
490  " Reads the expressions from the file `name', and returns a list of
491    expressions read from the file.
492    See also [[read]] "
493
494  readfile1
495  " Reads a single expression from the file `name'.
496    See also [[read]] "
497
498  readall
499  " Reads the expressions from the string or stream `src', and returns a
500    list of expressions read from the file.
501    See also [[read]] "
502
503  writefile
504  " Writes the value to the file `name'.
505    See also [[writefileraw]] "
506
507  sym
508  " Returns the symbol for `x'.
509    See also [[string]] "
510
511  int " Interprets `x' as a base-`b' integer. "
512
513  rand-choice
514  " Returns the result of one of the given `exprs', chosen at random.
515    See also [[random-elt]] "
516
517  n-of
518  " Repeats `expr' `n' times, then returns the results in a list.
519    See also [[repeat]] "
520
521  rand-string
522  " Generates a random string of letters and numbers. "
523
524  forlen
525  " Loops across the length of the sequence `s'.
526    See also [[repeat]] [[each]] [[on]] "
527
528  on
529  " Loops across the sequence `s', assigning each element to `var',
530    and providing the current index in `index'.
531    See also [[each]] [[forlen]] "
532
533  best
534  " Selects the best element of `seq' according to `f'.
535    `f' is a comparison function between elements of `seq'.
536    See also [[max]] [[most]] "
537
538  max
539  " Returns the highest argument.
540    See also [[min]] [[best]] [[most]] "
541
542  min
543  " Returns the lowest argument.
544    See also [[max]] [[best]] [[most]] "
545
546  most
547  " Selects the element of `seq' with the highest [f _].
548    `f' is a score function for elements of `seq'.
549    See also [[best]] [[least]] "
550
551  insert-sorted
552  " Inserts `elt' into a sequence `seq' sorted by `test'.
553    See also [[sort]] [[insort]] [[reinsert-sorted]] "
554
555  insort
556  " Inserts `elt' into a sequence in the place `seq' sorted by `test'.
557    See also [[insert-sorted]] [[sort]] "
558
559  reinsert-sorted
560  " Inserts `elt' into a sequence `seq', partially sorted by `test'.
561    See also [[insert-sorted]] [[insortnew]] [[sort]] "
562
563  insortnew
564  " Inserts `elt' into a sequence in the place `seq', partially sorted
565    by `test'.
566    See also [[reinsert-sorted]] [[sort]] "
567
568  memo
569  " Creates a function that will store results of calls to the given
570    source function.
571    For each set of arguments, the source function will only be called
572    once; if the memo'ed function is called again with the same arguments,
573    it will return the stored result instead of calling the source function.
574    See also [[defmemo]] "
575
576  defmemo
577  " Defines a function that automatically stores the results of calls.
578    For each set of arguments, this function will only execute once.
579    If the function is called again with the same arguments, it will
580    immediately return the stored result for that set of arguments.
581    See also [[memo]] "
582
583  <=
584  " Determines if each argument is less than or equal to succeeding
585    arguments. "
586
587  >=
588  " Determines if each argument is greater than or equal to succeeding
589    arguments. "
590
591  whitec
592  " Determines if the given `c' is a whitespace character.
593    See also [[alphadig]] [[nonwhite]] [[punc]] "
594
595  nonwhite
596  " Determines if the given `c' is not a whitespace character.
597    See also [[whitec]] [[alphadig]] [[punc]] "
598
599  letter
600  " True iff the given character `c' is a letter.
601    See also [[alphadig]] [[digit]] "
602
603  digit
604  " True iff the given character `c' is a digit.
605    See also [[alphadig]] [[letter]] "
606
607  alphadig
608  " Determines if the given `c' is an alphanumeric character.
609    See also [[letter]] [[digit]] [[whitec]] [[nonwhite]] [[punc]] "
610
611  punc
612  " Determines if the given `c' is punctuation character.
613    See also [[whitec]] [[nonwhite]] [[alphadig]] [[punc]] "
614
615  readline
616  " Reads a string terminated by a newline from the stream `str'. "
617
618  summing
619  " Counts the number of times `sumfn' is called with a true value
620    within `body'.
621    See also [[accum]] "
622
623  sum
624  " Sums (map f xs).
625    See also [[map]] [[reduce]] [[summing]] "
626
627  treewise
628  " Folds across `tree' as a binary tree, calling `base' on atoms (leafs) and
629    calling `f' on the results of recursion across the car and the cdr of conses
630    (internal nodes).
631    See also [[trav]] [[tree-subst]] [[ontree]] "
632
633  carif
634  " Returns the first element of a list if the argument is a list.
635    See also [[car]] [[caris]] "
636
637  prall
638  " Prints several arguments with an initial header and separated by a
639    given separator.
640    See also [[prs]] "
641
642  prs
643  " Prints several arguments separated by spaces.
644    See also [[prall]] "
645
646  tree-subst
647  " Replaces an element of a list with that list treated as a binary tree.
648    See also [[treewise]] [[trav]] "
649
650  ontree
651  " Applies `f' (for side effects) to each node of the binary tree `tree'.
652    A binary tree is eiher an atom or a cons of two binary trees.
653    See also [[treewise]] [[trav]] "
654
655  dotted
656  " Determines if `x' is a dotted cons pair.
657    See also [[acons]] [[alist]] "
658
659  fill-table
660  " Fills `table' with key-value pairs in the `data' list.
661    See also [[table]] "
662
663  keys
664  " Returns a list of keys in the table or object `h'.
665    See also [[vals]] [[table]] "
666
667  vals
668  " Returns a list of values in the table or object `h'.
669    See also [[keys]] [[table]] "
670
671  tablist
672  " Transforms a table or object `h' into an association list.
673    See also [[listtab]] [[alref]] [[assoc]] "
674
675  listtab
676  " Transforms an association list into a table or object.
677    See also [[tablist]] [[alref]] [[assoc]] "
678
679  obj
680  " Creates an object with the specified entries.
681    See also [[inst]] [[table]] "
682
683  load-table
684  " Loads an association list from `file' into a table or object.
685    See also [[load-tables]] [[read-table]] [[save-table]] [[listtab]] "
686
687  read-table
688  " Loads an association list from the stream `i' into a table or object.
689    See also [[load-tables]] [[load-table]] [[write-table]] [[listtab]] "
690
691  load-tables
692  " Loads several association lists from `file' into a list of tables or
693    objects.
694    See also [[load-table]] [[read-table]] "
695
696  save-table
697  " Writes a table or object `h' to `file'.
698    See also [[write-table]] [[load-table]] [[tablist]] "
699
700  write-table
701  " Writes a table or object `h' to the stream `o'.
702    See also [[save-table]] [[read-table]] [[tablist]] "
703
704  copy
705  " Creates a copy of an existing argument `x'.
706    See also [[rev]] "
707
708  abs " Returns the absolute value of a number. "
709
710  round
711  " Rounds off a fractional value to the nearest whole number.
712    See also [[roundup]] [[to-nearest]] "
713
714  roundup
715  " Rounds off a fractional value to the nearest absolute highest
716    whole number.
717    See also [[round]] [[to-nearest]] "
718
719  nearest
720  " Rounds off `n' to the nearest multiple of `quantum'.
721    See also [[round]] [[roundup]] "
722
723  avg
724  " Averages all numbers in `ns'.  See also [[med]] "
725
726  med
727  " Computes the median of `ns' according to the comparison `test'.
728    See also [[avg]] "
729
730  sort " Sorts `seq' according to `test'.  See also [[mergesort]] "
731
732  mergesort
733  " Sorts a list `lst' according to `less?'.  See also [[merge]] [[sort]] "
734
735  merge " Merges two sorted lists by `less?'.  See also [[mergesort]] "
736
737  bestn
738  " Returns a list of the best `n' elements of seq according to
739    the comparison function `f'.
740    See also [[best]] "
741
742  split
743  " Splits `seq' at offset `pos', returning a two-element list of the
744    split.
745    See also [[cut]] "
746
747  time
748  " Prints the time consumed by evaluating `expr', returning the result.
749    See also [[jtime]] [[time10]] "
750
751  jtime
752  " Prints the time consumed by `expr', returning `ok' when the
753    expression completes.
754    See also [[time]] [[time10]] "
755
756  time10
757  " Prints the time consumed by executing `expr' 10 times.
758    See also [[time]] [[jtime]] "
759
760  deftem
761  " Defines an object template for field values, with inclusion for
762    existing templates.
763    See also [[inst]] [[templatize]] [[temread]] [[temload]] [[temloadall]] "
764
765  inst
766  " Creates an object instantiating a given template.
767    See also [[deftem]] [[templatize]] [[temread]] [[temload]] [[temloadall]] "
768
769  temread
770  " Reads an association list from the stream `str' and creates an
771    object instantiating the given template containing the data in
772    the association list.
773    See also [[deftem]] [[inst]] [[templatize]] [[temload]] [[temloadall]] "
774
775  templatize
776  " Creates an object instantiating a given template containing the
777    data in the association list `raw'.
778    See also [[deftem]] [[inst]] [[temread]] [[temload]] [[temloadall]] "
779
780  temload
781  " Reads an association list from `file' and creates an object
782    instantiating the given template containing the data in the
783    association list.
784    See also [[deftem]] [[inst]] [[templatize]] [[temread]] [[temloadall]] "
785
786  temloadall
787  " Reads all association lists from `file' and creates a list
788    of objects instantiating the given template containing the
789    data in each association list.
790    See also [[deftem]] [[inst]] [[templatize]] [[temread]] [[temload]]"
791
792  number
793  " Determines if `n' is a number. "
794
795  ; TODO: better description for 'cache
796  cache
797  " Caches the result of a call to `valf' until a number of seconds
798    greater than the result of a call to `timef' have passed. "
799
800  errsafe
801  " Executes `expr' and blocks any errors "
802
803  saferead
804  " Reads an expression, blocking any errors. "
805
806  safe-load-table
807  " Loads a table from `filename', blocking any errors. "
808
809  ensure-dir
810  " Ensures that the specified directory exists, and creates it if not
811    yet created. "
812
813  date " Returns the date as a triple of numbers: (year month day). "
814
815  datestring " Returns the date as a string in YYYY-MM-DD format."
816
817  count " Counts the number of elements in `x' which pass `test'. "
818
819  ellipsize
820  " Trims a string `str' with `...' if it is longer than the given `limit'. "
821
822  rand-elt
823  " Returns an element of `seq' chosen by random.  See also [[rand-choice]] "
824
825  until
826  " While `test' is false, perform `body' in a loop.
827    See also [[while]] "
828
829  before " Determines if `x' exists before `y' in `seq'. "
830
831  orf
832  " Creates a function which returns true on its argument if any of the
833    given `fns' return true on that argument.
834    See also [[andf]] "
835
836  andf
837  " Creates a function which returns true on its argument if all of the
838    given `fns' return true on that argument.
839    See also [[orf]] "
840
841  atend
842  " Determines if the index `i' is at or beyond the end of the sequence `s'. "
843
844  multiple " Determines if `x' is a multiple of `y'. "
845
846  nor
847  " Computes arguments until one of them returns true, then returns nil,
848    or else returns true.
849    See also [[and]] [[or]] "
850
851  compare
852  " Creates a function that compares using `comparer' the result of `scorer'
853    on its arguments. "
854
855  conswhen
856  " Adds `x' to the front of `y' if `x' passes the test `f'.
857    See also [[consif]] [[adjoin]] "
858
859  retrieve
860  " Returns the first `n' elements of `xs' which pass `f'.
861    See also [[firstn]] [[keep]] "
862
863  dedup " Returns `xs' sans duplicates. "
864
865  single " Determines if `x' is a list with only one element. "
866
867  intersperse " Inserts `x' between elements of `ys'. "
868
869  counts
870  " Returns a table with elements of `seq' as keys and the number of
871    occurences of that element as values. "
872
873  commonest
874  " Returns a two-element list containing the most common element of
875    `seq' and the number of times it occured in the sequence. "
876
877  reduce
878  " Applies `f' to an accumulated result on the elements of `xs'.
879    Elements are processed left-to-right.
880    `f' is applied to at most 2 elements at a time.
881    See also [[rreduce]]
882   "
883
884  rreduce
885  " Applies `f' to an accumulated result on the elements of `xs'
886    Elements are processed right-to-left.
887    `f' is applied to at most 2 elements at a time.
888    See also [[reduce]] "
889
890  parse-format
891  " Parses a simple ~-format string. "
892
893  prf
894  " Prints according to a format string, replacing ~* with arguments. "
895
896  load
897  " Reads the expressions in `file' and evaluates them. "
898
899  w/table " Creates a table assigned to `var' for use in `body'. "
900
901  ero " Outputs `args' to stderr. "
902
903  queue
904  " Creates a queue.
905    See also [[enq]] [[deq]] [[qlen]] [[qlist]] [[enq-limit]]"
906
907  enq " Adds `obj' to a queue.  See also [[queue]] "
908
909  deq " Removes and returns an item from a queue.  See also [[queue]] "
910
911  qlen " Returns the number of items in a queue.  See also [[queue]] "
912
913  qlist " Returns the queue contents as a list.  See also [[queue]] "
914
915  enq-limit
916  " Adds an item to the queue; removes a queue item if `limit' is
917    exceeded.  See also [[queue]] "
918
919  median " Computes the median of an unsorted list. "
920
921  noisy-each
922  " Performs `body' for each element of the sequence returned by `val',
923    with each element assigned to `var'; prints a `.' every `n' elements. "
924
925  point
926  " Creates a form which may be exited by calling `name' from within `body'.
927    See also [[catch]] "
928
929  catch
930  " Catches any value returned by `throw' within `body'.
931    See also [[point]] "
932
933  downcase
934  " Converts `x' to lowercase, if a character, string, or symbol;
935    otherwise, raises an error.
936    See also [[upcase]] "
937
938  upcase
939  " Converts `x' to uppercase, if a character, string, or symbol;
940    otherwise, raises an error.
941    See also [[downcase]] "
942
943  range "Return a range of numbers from `start' to `end', by `step'."
944
945  mismatch " Returns the first index where `s1' and `s2' do not match. "
946
947  memtable
948  " Creates a membership table which returns t for each element in `ks' and
949    nil otherwise. "
950
951  w/bars
952  " Prints out the strings printed by each expression in `body',
953    separated by vertical bars (or whatever the value of `bar*' is). "
954
955  thread
956  " Launches the expressions in `body' in a new thread, returning the
957    thread ID for that thread. "
958
959  trav
960  " Traverses an object `x'; each function in `fs' is applied to it, and
961    sub-nodes of the object may be traversed by (self <node>) in any of the
962    functions.
963    See also [[treewise]] [[ontree]] "
964
965  get
966  " Returns a fn that calls it argument on `index'. "
967
968  butlast
969  " Returns a list containing every element of `x' but the last.
970    See also: [[cut]] "
971
972  between
973  " As 'each, but runs `within' between each iteration of `body'.
974    See also [[each]] "
975
976  tofile
977  " Redirects stdout to the file `name' within `body'. 
978    See also [[fromfile]] [[w/outfile]] [[w/stdout]] "
979
980  fromfile
981  " Redirects standard input from the file `name' within `body'.
982    See also [[tofile]] [[w/infile]] [[w/stdin]] "
983
984  mapeach
985  " Maps `(fn (,var) ,@body)' over `lst'.
986    See also [[each]] [[map]] [[mappendeach]] "
987  )