Documentation for Big Scheme Big Scheme is a set of generally useful facilities. Easiest way to access these things: > ,open big-scheme Load structure big-scheme (y/n)? y ... A better way is to use the module system. ----- Ascii conversions (CHAR->ASCII ) => (ASCII->CHAR ) => These are identical to CHAR->INTEGER and INTEGER->CHAR except that they use the ASCII encoding. ----- Bitwise operations (BITWISE-NOT ) => (BITWISE-AND ) => (BITWISE-IOR ) => (BITWISE-XOR ) => These perform various logical operations on integers on a bit-by-bit basis, using a two's-complement representation. (ARITHMETIC-SHIFT ) => Shift the integer by the given bit count, shifting left for positive counts and right for negative ones. A two's complement representation is used. ----- Hash tables (MAKE-TABLE) => (MAKE-STRING-TABLE) => Make a new, empty table. MAKE-TABLE returns a table that uses EQ? for comparing keys and an ad-hoc hash function. String tables uses strings for keys. (MAKE-TABLE-MAKER ) => Returns a procedure of no arguments that makes tables that use the given comparison and hash procedures. ( ) => ( ) => (TABLE? ) => True if is a table. (TABLE-REF
) => Return the value for in
, or #F if there is none. should be of a type appropriate for
. (TABLE-SET!
) => Make be the value of in
. should be of a type appropriate for
. (TABLE-WALK
) => Apply , which must accept two arguments, to every associated key and value in
. ----- Enumerations (DEFINE-ENUMERATION ( ...)) *SYNTAX* Defines to be an enumeration with components .... Also defines -COUNT to be the number of components. (ENUM ) => *SYNTAX* Evaluates to the value of within the enumeration . For example, if (DEFINE-ENUMERATION COLOR (GREEN RED)), then (ENUM COLOR GREEN) is zero and (ENUM COLOR RED) is one. The mapping from name to integer is done at macro-expansion time, so there is no run-time overhead. (ENUMERAND->NAME ) => Returns the name associated with within . E.g. (ENUMERAND->NAME 1 COLOR) => 'RED. (NAME->ENUMERAND ) => Returns the integer associated with within . E.g. (ENUMERAND->NAME 'GREEN COLOR) => 0. ----- Port extensions (MAKE-TRACKING-INPUT-PORT ) => (MAKE-TRACKING-OUTPUT-PORT ) => These return ports that keep track of the current row and column and are otherwise identical to their arguments. (MAKE-STRING-INPUT-PORT ) => Returns a port that reads characters from the supplied string. (CALL-WITH-STRING-OUTPUT-PORT ) => The procedure is called on a port. When it returns, CALL-WITH-STRING- OUTPUT-PORT returns a string containing the characters written to the port. (WRITE-ONE-LINE ) => The procedure is called on an output port. Output written to that port is copied to until characters have been written, at which point WRITE-ONE-LINE returns. (CURRENT-ROW ) => or #f (CURRENT-COLUMN ) => or #f These return the current read or write location of the port. #F is returned if the port does not keep track of its location. (FRESH-LINE ) => Write a newline character to if its current column is not 0. (INPUT-PORT? ) => (OUTPUT-PORT? ) => These are versions of the standard Scheme predicates that answer true for extended ports. ----- Queues (MAKE-QUEUE) => Returns a new, empty queue. (ENQUEUE! ) => Puts on the queue. (DEQUEUE! ) => Removes and returns the first element of the queue. (QUEUE-EMPTY? ) => True if the queue is empty. (QUEUE? ) => True if is a queue. (QUEUE->LIST ) => Returns a list of the elements of the queue, in order. (QUEUE-LENGTH ) => The number of elements currently on the queue. (DELETE-FROM-QUEUE! ) => Removes the first occurance of from the queue, returning true if it was found and false otherwise. ----- Little utility procedures (ATOM? ) => (ATOM? x) == (NOT (PAIR? x)) (NULL-LIST? ) => Returns #t for the empty list, #f for a pair, and signals an error otherwise. (NEQ? ) => (NEQ? x y) is the same as (NOT (EQ? x y)). (N= ) => (N= x y) is the same as (NOT (= x y)). (IDENTITY ) => (NO-OP ) => These both just return their argument. NO-OP is guaranteed not to be compiled in-line, IDENTITY may be. ----- List utilities (MEMQ? ) => Returns true if is in , false otherwise. (ANY? ) => Returns true if is true for any element of . (EVERY? ) => Returns true if is true for every element of . (ANY ) (FIRST ) ANY returns some element of for which is true, or #F if there are none. FIRST does the same except that it returns the first element for which is true. (FILTER ) (FILTER! ) Returns a list containing all of the elements of for which is true. The order of the elements is preserved. FILTER! may reuse the storage of . (FILTER-MAP ) The same as FILTER except the returned list contains the results of applying instead of elements of . (FILTER-MAP p l) is the same as (FILTER IDENTITY (MAP p l)). (PARTITION-LIST ) => (PARTITION-LIST! ) => The first return value contains those elements for which is true, the second contains the remaining elements. The order of the elements is preserved. PARTITION-LIST! may resuse the storage of the . (REMOVE-DUPLICATES ) => Returns its argument with all duplicate elements removed. The first instance of each element is preserved. (DELQ ) => (DELQ! ) => (DELETE ) => All three of these return with some elements removed. DELQ removes all elements EQ? to . DELQ! does the same and may modify the list argument. DELETE removes all elements for which is true. Both DELQ and DELETE may reuse some of the storage in the list argument, but won't modify it. (REVERSE! ) => Destructively reverses . (SORT-LIST ) => (SORT-LIST! ) => Returns a sorted copy of . The sorting algorithm is stable. (SORT-LIST '(6 5 1 3 2 4) <) => '(1 2 3 4 5 6) ----- Additional syntax (DESTRUCTURE (( ) ...) ...) *SYNTAX* The s are evaluated and their values are dissasembled according to the corresponding patterns, with identifiers in the patterns being bound to fresh locations holding the corresponding part, and the body is evaluated in the extended environment. Patterns may be any of the following: #f Discard the corresponding part. Bind the to the part. ( ...) The part must be a list at least as long as the pattern. ( ... . ) The same thing, except that the final CDR of the part is dissasembled according to . #( ...) The part must be a vector at least as long as the pattern. (RECEIVE ...) *SYNTAX* => (CALL-WITH-VALUES (LAMBDA () ) (LAMBDA ...)) Bind to the values returned by , and evaluate the body in the resulting environment. ----- Printing and related procedures (CONCATENATE-SYMBOL . ) Returns the symbol whose name is produced by concatenating the DISPLAYed representations of . (CONCATENATE-SYMBOL 'abc "-" 4) => 'abc-4 (FORMAT . ) => or Prints the arguments to the port as directed by the string. should be either: An output port. The output is written directly to the port. The result of the call to FORMAT is undefined. #T. The output is written to the current output port. The result of the call to FORMAT is undefined. #F. The output is written to a string, which is then the value returned from the call to FORMAT. Characters in which are not preceded by a ~ are written directly to the output. Characters preceded by a ~ have the following meaning (case is irrelevant; ~a and ~A have the same meaning): ~~ prints a single ~ ~A prints the next argument using DISPLAY ~D prints the next argument as a decimal number ~S prints the next argument using WRITE ~% prints a newline character ~& prints a NEWLINE character if the previous printed character was not one (this is implemented using FRESH-LINE) ~? performs a recursive call to FORMAT using the next two arguments as the string and the list of arguments (ERROR . ) (BREAKPOINT . ) Signals an error or breakpoint condition, passing it the result of applying FORMAT to the arguments. (P ) (P ) (PRETTY-PRINT ) Pretty-print . The current output port is used if no port is specified. is the starting offset. will be pretty-printed to the right of this column. Original by RK, 26 Jan 1993. Minor changes by JAR, 5 Dec 1993.