next up previous contents
Next: 8 Foreign function interface Up: QScheme Documentation Previous: 6 Expressions   Contents

Subsections

7 QScheme procedures

In this section I give a list of native QScheme types and of procedures operating on this types. Most of the types are described in the R5RS document and hence documented very briefly here. New types are described in greater detail.

7.1 Atom

Atoms are unique strings collected in a hash, the atom hash. They are used anywhere we need unique strings. Symbol names and keywords are examples of atoms

(atom-hash) -> hash

Returns a pointer to the hash table containing all atoms.

(string->atom str) -> atom

Creates an atom from the string given as argument.

(atom->string atom) -> str

Creates a new string from the atom.

7.2 Symbol

A symbol has a name and a value. The name of a symbol is an atom, it's value may be any valid Scheme object. New symbols are created by the (define sym value) special form.

(symbol? obj ) -> <boolean>

(symbol->string symbol ) -> <string>

See R5RS.

*THINK*: should we provide a way to undefine a symbol ?

7.3 Keyword

Keywords are special symbols that evaluate to themselves. The keywords are recognized by the read procedure. A keyword usually starts with a ':' - refer to 5.3. Example:

:test -> :test

7.4 Pair

A pair consists of two pointers to other Scheme objects. The name of the pointers are CAR and CDR for historical reasons. Here I refer to them as the car and cdr field of the pair. The procedures dealing with pairs all comply with the R5RS specification. They are:

(pair? object) -> <boolean>

Returns #t if object is a pair.

(cons arg1 arg2) -> <pair>

Creates a new pair whose CAR is arg1 and CDR is arg2.

(car pair) -> <object>

Returns the content of the car field of the pair.

(cdr pair) -> <object>

Returns the content of the cdr field.

(caar pair)  
(cadr pair)  
...  
(cdddar pair)  
(cddddr pair)

Successive composition of car and cdr function, up to 4 level deep.

(cdr pair) -> <object>

Returns the content of the cdr field.

(set-car! pair object) -> #undefined

Sets the content of the car field of the pair to object.

(set-cdr! pair object) -> #undefined

Sets the content of the cdr field of the pair to object.

(null? obj) -> <boolean>

Returns #t if obj is the empty list, #f otherwise.

7.5 List

All procedures of R5RS are implemented.

(list? obj) -> <boolean>

Function description.

(length list) -> <number>

Function description.

(append list ...) -> <list>

Function description.

(reverse list) -> <list>

Function description.

(list-tail list n) -> <object>

Returns a sublist of list omitting the first n elements.

(list-ref list n) -> <object>

Returns the nth element of list

(memq obj list) -> <list>
(memv obj list) -> <list>
(member obj list) -> <list>

Returns the first sublist where car is obj . memq uses eq? to compare elements, memv uses eqv? and member uses equal?.

(assq obj alist) -> <list>
(assv obj alist) -> <list>
(assoc obj alist) -> <list>

See R5RS

(for-each func list) -> #undefined  
(map func list) -> <list>

See R5RS

7.6 Character

Characters are used - as the name tells - to represent printed characters. Character uses the notation #\<character> or #\<character name>, see R5RS and table 3 for more details.

Table 3: Character name
Character name Character ASCII (decimal)
#\null '\0', the NUL character 0
#\bell '\t' , the character ringing the bell 7
#\backspace the backspace 8
#\tab horizontal tab 9
#\newline newline 10
#\vtab vertical tab 11
#\formfeed formfeed 12
#\return return 13
#\space space 32




.

The procedures handling characters are R5RS-compliant. They are:

(char? obj) -> <boolean>

Return #t if object is a character

(char=? char1 char2) -> <boolean>
(char<? char1 char2) -> <boolean>
(char>? char1 char2) -> <boolean>
(char<=? char1 char2) -> <boolean>
(char>=? char1 char2) -> <boolean>
(char-ci=? char1 char2) -> <boolean>
(char-ci<? char1 char2) -> <boolean>
(char-ci>? char1 char2) -> <boolean>
(char-ci<=? char1 char2) -> <boolean>
(char-ci>=? char1 char2) -> <boolean>

Character comparison, See R5RS

(char-alphabetic? char) -> <boolean>  
(char-numeric? char) -> <boolean>
(char-whitespace? char) -> <boolean>
(char-upper-case? char) -> <boolean>
(char-lower-case? char) -> <boolean>

Character classification tests. See R5RS

(char->integer char) -> <number>
(integer->char number) -> <char>

Character conversion. See R5RS

(char-upcase char) -> <char>
(char-downcase char) -> <char>

Character conversion. See R5RS

7.7 String

The string procedures are mostly compatible with R5RS.

(string? object) -> <boolean>
Returns #t if object is a string.

(make-string size [char]) -> <string>
Creates a new string from size chars, optionally filled with char. If char is not specified, the string is filled with the character #\null.

(string char ...) -> <string>
Creates a new string from the characters given as argument.

(string-length str) -> <number>
Returns the current length of the string.

(string-ref str k) -> <char>
Returns the kth character of string. The indexing is 0-based.

(string-set! str k char) -> <number>
Changes the kth character of string.

(string=? str1 str2) -> <boolean>
(string<? str1 str2) -> <boolean>
(string>? str1 str2) -> <boolean>
(string<=? str1 str2) -> <boolean>
(string>=? str1 str2) -> <boolean>
String comparison.

(string-ci=? str1 str2) -> <boolean> 
(string-ci<? str1 str2) -> <boolean>
(string-ci>? str1 str2) -> <boolean>
(string-ci<=? str1 str2) -> <boolean>
(string-ci>=? str1 str2) -> <boolean>
Case insensitive string comparison

(substring str start end) -> <string>
Returns the substring of str, starting at position start and terminating at position end. See R5RS

(string-length str) -> <number>
Returns the length of the string str.

(string-append str ...) -> <str>
Returns the length of the string str.

(string->list str) -> <list>
Returns a list consisting of the chars contained in string str.

(list->string list) -> <string>
Builds a string from a list of chars.

(string-copy str) -> <string>
Returns a fresh copy of a string.

(-fill! str char) -> #undefined
Replaces all character of str by char.

(string-append2 str1 str2) -> <string>
Returns the concatenation of str1 and str2.

(string-index string search) -> <number> | #f
Returns the index in string where search appears first. The search argument can be either a <character> or a <string>. Returns #f if the string search cannot be found. This is an extension to R5RS.

(string-chop obj) -> obj
If obj is a string, the size of the string is shortened to exclude the first newline if any. If obj is not a string, obj is left unchanged. Note that the allocated size2 of the string is not changed. Only the apparent length of the string is changed. This is an extension to R5RS.

> (string-chop "Hello world\n\nI said...\n")

"Hello world"

(string-split delim str) -> <list>
Returns a list of the substrings of str that are delimited by one of the characters in the delim string. Example:

> (string-split "\t " "Hello world")

("Hello" "world")

> (string-split ":" (hash-ref environ "PATH") )

("/usr/bin" "/bin" "/usr/bin/X11" "/usr/games" "/usr/local/bin" ".")

> (string-split "/" "/usr/local/bin")

("" "usr" "local" "bin")

(string-join sep list) -> string
Is the inverse transformation of string-split. It takes a list of string and returns a new string composed of all string of list separated with sep. Example:

> (string-join "|" (string-split ":" (hash-ref environ "PATH")))

"/usr/bin|/bin|/usr/bin/X11|/usr/games|/usr/local/bin|."

> (string-join "<sep>" (string-split "/:" (hash-ref environ "PATH")))

"<sep>usr<sep>bin<sep>bin<sep>usr<sep>bin<sep>X11<sep>usr<sep>games<sep>usr<sep>local<sep>bin<sep>."

(string-translate strimg from repl) -> string
Returns a new string, substituting the characters of string matching characters in the from string to the corresponding character in the repl string. Example:

> (string-translate "Hello World" "HWo" "hwO")

"hellO wOrld"

(string-pack template obj ...) -> string
Creates a binary structure and returns it as string. The various obj arguments are placed successively in the target string by following the specifications of the template string. The template string defines a sequence of fields, where each field is described by a one-character type and an optional length. The type characters have the following meaning:



Character Description
a A string with arbitrary binary data, will be null padded.
A An ASCII string, will be padded with spaces and null.
Z An ASCII string, will be padded with nulls.
b A bit string (ascending bit order).
B A bit string (descending bit order).
h A hex string (low nibble first).
H A hex string (high nibble first).
c A signed char value.
C An unsigned char value.
s A signed short value (16 bits).
S An unsigned short value (16 bits).
i A signed integer value (at least 32 bits).
I An unsigned integer value (at least 32 bits).
L A signed long value.
n A short in "network" (big-endian) order.
N A long in "network" (big-endian) order.
v A short in "VAX" (little-endian) order.
V A long in "VAX" (little-endian) order.
f A single-precision float in the native format.
d A double-precision float in the native format.
p A pointer-to-string in the native format.
P A pointer-to-structure in the native format.
x A null byte.
X Remove byte.



The following rules apply:

Note:
the string-pack was inspired from the PERL language. It has more or less the same syntax.
(string-unpack template string) -> list
Extracts the fields contained in the string according to the specifications of the template string. The extracted elements are returned in order in a list. See string-pack for a description of the template.

(string-resize! string len) -> string
Changes the length of the string string to length len. If the string expands, the added characters will be filled with random data.

7.8 Vector

All procedures of R5RS are implemented.

(vector? object) -> <boolean>
Returns #t if obj is a vector.

(make-vector k [fill]) -> <vector>
Returns #t if obj is a vector.

(vector obj ...) -> <vector>
Returns a newly allocated vector whose elements are the given arguments.

(vector-length vector) -> <number>
Returns the number of elements in vector.

(vector-ref vector k) -> <object>
Returns the kth element of the vector.

(vector-set! vector k obj) -> #undefined
Sets the kth element of the vector to obj.

(vector->list vector) -> <list>
(list->vector list) -> <vector>
Converts a vector to a list and vice versa.

(vector-fill! vector obj) -> <vector>
Changes all elements of vector to object obj.

(vector-resize vector newsize) -> <vector>
Changes the size of a vector to newsize.

(vector-append v1 v2) -> <vector>
Creates a new vector which is composed of all elements of v1 and of v2, appending v2 to v1.

7.9 Hash

Figure 1: The various hash type
\includegraphics{hashes.eps}

A hash is a data structure used to store key/value pairs for fast access. The keys are assumed to be unique. The acceptable key type depends on the hash type. For a generic type, any key may be used. For symbol hashes, only atoms or strings are acceptable. Atom hash is very special because no value can be associated with key. You can use atom hash only for setting keys and testing existence of keys.

(make-hash [type]) -> <hash>
Creates a hash. Hash types are: SCM_HASH_T_GEN for generic (normal) hashes, SCM_HASH_T_SYMBOL for symbol hash and SCM_HASH_T_ATOM for atom hash. If no type argument is given, a generic hash is created.

(make-symbol-hash) -> <hash>
Creates a symbol hash.

(make-atom-hash) -> <hash>
Creates an atom hash. Atom hash has no value associated with key.

(hash? hash) -> <boolean>
Returns #t if it's a hash, #f otherwise.

(atom-hash? hash) -> <boolean>
Returns #t if it's an atom hash, #f otherwise.

(symbol-hash? hash) -> <boolean>
Returns #t if it's a symbol hash, #f otherwise.

(generic-hash? hash) -> <boolean>
Returns #t if it's a generic hash, #f otherwise.

(hash-set! hash key value) -> <hash>
Creates/changes the value associated with key.

(hash-ref hash key) -> <value>
Returns the value associated with the key or #undefined if not found.

(hash-stat hash) -> #undefined
Prints the statistics for the hash. Useful for hash optimization.

(hash->list hash) -> <list>
Returns a list containing all elements of the hash. Elements are association pairs where car is the key and cdr is the value.

(list->hash list) -> <hash>
Builds a hash from an association list.

7.10 Number

The documentation is again very skinny here ... refer to R5RS.

(number? obj) -> <boolean>
(integer? obj) -> <boolean>
(real? obj) -> <boolean>
(exact? obj) -> <boolean>
(inexact? obj) -> <boolean>
Type predicates.

(< n1 n2 ...) -> <boolean>
(<= n1 n2...) -> <boolean>
(>= n1 n2 ...) -> <boolean>
(> n1 n2 ...) -> <boolean>
(= n1 n2 ...) -> <boolean>
Numeric comparisons.

(zero? number) -> <boolean>  
(positive? number) -> <boolean>  
(negative? number) -> <boolean>  
(odd? number) -> <boolean>  
(even? number) -> <boolean>
Number classes.

(min n1 n2 ...) -> <number>
(max n1 n2 ...) -> <number>
Returns the smallest, respectively the largest number of the given arguments.

(+ n1 n2 ...) -> <number>
(- n1 n2 ...) -> <number>
(* n1 n2 ...) -> <number>
(/ n1 n2 ...) -> <number>
Arithmetic operations.

(abs n) -> <number>
Absolute value.

(quotient n1 n2) -> <number>
(remainder n1 n2) -> <number>
(modulo n1 n2) -> <number>
Integer division and modulo operations.

(gcd n1 n2 ...) -> <number>
(lcm n1 n2 ...) -> <number>
Gcd and lcm of numbers.

(floor n) -> <number>  
(ceil n) -> <number>
(truncate n) -> <number>
(round n) -> <number>
Rounding operations.

(exp n) -> <number>
(log n) -> <number>
(log10 n) -> <number>
(sin n) -> <number>
(cos n) -> <number>
(tan n) -> <number>
(asin n) -> <number>
(acos n) -> <number>
(atan n1 n2) -> <number>
(sqrt n) -> <number>
(expt n1 n2) -> <number>
Mathematical functions.

(random) -> <number>
Generates a random number in range 0.0-1.0 exclusive. Maximum precision is 48 bits.

(exact->inexact n) -> <number>
(inexact->exact n) -> <number>
Type conversions

(number->string number [base]) -> <string>
(string->number string [base]) -> <number>
Convert to/from string.

(1+ n) -> <number>
(2+ n) -> <number>
(1- n) -> <number>
(2- n) -> <number>
Speedy increments and decrements.

(float-precision digits) -> old
Set the number of digits after the '.' to display when printing a float number.

pi 
The number PI.

7.11 Input / output

Input-output in Scheme is based on the concept of port. Refer to 6.6.1 in R5RS.

(port? obj) -> <boolean>
Returns #t if obj is a valid port object.

(input-port? obj) -> <boolean>
Returns #t if obj is a valid input port object.

(output-port? obj) -> <boolean>
Returns #t if obj is a valid output port object.

(current-input-port) -> <port>
(current-output-port) -> <port>
(current-error-port) -> <port>
Returns the current port for the default input / output / error stream.

(with-input-from-file str thunk) -> <anything>
(with-output-to-file str thunk) -> <anything>
Redirects standard input or output to/from the file named by str. thunk is a procedure without any arguments. The value returned is the value returned by the thunk.

Example of redirections with with-output-to-file and with-input-from-file:

> (with-output-to-file "/tmp/tst" (lambda () (write 123) (newline)))

#undefined

> (system "cat /tmp/tst")

123

0

> (with-input-from-file "/tmp/tst" (lambda () (read)))

123

(with-input-from-string str thunk) -> <anything>
(with-output-to-string thunk) -> <string>
Redirects the standard input or output to/from string. thunk is a procedure without any arguments. The value returned by with-input-from-string is the value returned by the thunk. The value returned by with-output-to-string is the entire string built in thunk.

For example:

> (with-output-to-string (lambda () (write "Hello world") (write 123)))

"\"Hello world\"123"

(open-input-file string) -> <port>  
(open-output-file string) -> <port>
Opens the file named by string for reading respectively writing. An error exception is thrown if the file cannot be opened.

(open-input-string string) -> <port>  
(open-output-string) -> <port>

**** Open file for reading respectively writing. An error exception is thrown when file cannot be opened. ****

(get-output-string <output-string-port>) -> <string>
Returns the string currently built at the output-string-port.

(close-port port) -> <boolean> | <string>
(close-input-port port) -> <boolean> | <string>
(close-output-port port) -> <boolean> | <string>
These functions close an open port. If port is an output string port, the string output is returned. ****

(read-char [port]) -> <char> | #eof
(peek-char [port]) -> <char> | #eof
Reads a character from the port passed as an argument. If no port argument is given, the current-input-port is used as input port. peek-char does not advance the character position of the port.

(read-line [port]) -> <string> | #eof
Reads a line from the port passed as an argument. If no port argument is given, the current-input-port is used as the input port.

(eof-object? obj) -> <boolean>
Returns #t if obj is a #eof.

(char-ready? port) -> <boolean>
Not implemented. I'm sorry, but I don't see why you want to use this function in a Unix environment.

(flush-output [port] ) -> #t
Flushes the port. If no port is given, the default output port is flushed.

(file-position port [pos]) -> position
Gets or sets the current position on a file port. If no position is given the current position is returned. Otherwise, the current file position is set to the pos value.

7.12 Error handling

The error handling is implemented by two functions: catch and throw. The catch form defines a context where errors are trapped and a function to handle the errors occurring in that context. The throw function signals an error of a specific type and provides a description of the error in a string. The error signal is sent to the catch having the same tag or to the innermost resp. top-level catch if the tag is #f resp. #t. When a match is found, the handler is called with the tag and the string thrown as arguments. When the handler terminates, the execution resumes after the catch form and the value returned by the handler will be returned by the catch form.

When throwing, the tag #t can be used to force a top-level error with no resume, some kind of abort.

(catch taglist handler expr ...)
The catch construct traps exceptions occurring during the execution of the expressions. The taglist is a list of tags being caught. The handler function takes 2 arguments, a tag and a message. The handler function is called when an exception matching one of the tags has been thrown from inside the expr. If no exceptions occur, the catch construct returns the value of the last expression. If an exception is trapped, the value returned is the value returned by the handler function, if any.

(throw tag string)
Sends an exception to the first catch matching the tag. The tag and string are passed to the handler function for display purposes. If tag is #t the top-level catch is activated. If the tag is #f the handler of the enclosing catch is activated.

Example of a throw to an enclosing catch:

> (catch (a b) (lambda (t m)

                 (display "handler: catch: ") (display t) 

                 (display " msg: ") (print m) #f)

     (throw 'a "ERROR A"))

*** throw: tag=a msg=ERROR A

*** catch: scm_catch_list=()

handler: catch: a msg: ERROR A

#f

Example of a throw to first enclosing catch:

> (catch (a b) (lambda (t m)

                 (display "handler: catch: ") (display t) 

                 (display " msg: ") (print m) #f)

     (throw #f "ERROR A"))

*** throw: tag=#f msg=ERROR A

*** catch: scm_catch_list=()

handler: catch: #f msg: ERROR A

#f

Example of a throw to top-level catch:

> (catch (a b) (lambda (t m)

                  (display "handler: catch: ") (display t) 

                  (display " msg: ") (print m) #f)

    (throw #t "TOPLEVEL ERROR"))

*** throw: tag=#t msg=TOPLEVEL ERROR

toplevel restart: k=1

7.13 Module

The module system implements private name spaces in different level. It provides a way to control what names may be used from outside the module. This is a small example of module definitions:

(module A

  (export x)

  (define x 10))

 

(module B

  (export x)

  (define x 20))

 

(module C

  (import A B)

  (print x))

 

=> 10

I have a syntactic sugar notation: to access objects of a modules you can use the module::symbol notation. Example:

(print A::x)

=> 10

Note: the default module which holds all the Scheme definitions is the global module.

(module module expr...)
Creates or reuses a module. Every module uses a separate symbol hash to hold the definitions it contains. Definitions occurring in a module will not conflict with definitions in other modules.

(export symbol1 symbol2 ...)
Gives a list of symbols that can be used outside of this module.

(import module1 module2 ...)
Imports all the exported symbols of the modules listed here. The list of modules is searched from left to right.

(current-module) -> module
Returns the current module.

(set-current-module module)
Sets the current module

(make-module name)-> module
Creates a new module. If a module of that name already exists, the module associated with name is returned.

module-hash -> hash
Returns the hash associating names to modules.

(module-exports module)-> list
Returns the list of exported symbols.

(module-imports module)-> list
Returns the list of imported symbols.

(module-symbols module)-> hash
Returns a hash containing the symbol list.

(find-module name)-> module
Searches a module in module hash and returns a module or #f if not found.

*REVIEW*

7.14 Pointer

Pointers are used to pass opaque types. You will receive pointers when you use the :item keyword in the foreign function interface.

(pointer? obj)-> <boolean>
Returns #t when obj is a pointer #f otherwise.

(null-pointer? obj)-> <boolean>
Returns #t when obj is a null pointer #f otherwise.

7.15 Process

QScheme supports process forking and piping. The interface is described hereafter.

(make-process in out err string ...)-> <process>
(make-process in out err list)-> <process>
(make-process in out err vector)-> <process>
Creates a new process. The values allowed for in, out and err are given in the table 4

Table 4: Allowed values for make-process in out and err
Type Description
:null Nothing connected here
:pipe Create a pipe
string Open a file and redirect from/to it
port Use an already opened port
number Redirect to an already opened slot


. After this call, a new process is created and a process descriptor is returned. If anything goes wrong, an error will be generated.

The command specification string can be provided to make-process in three different ways, namely as as in-lined strings or as a list of strings or an array of strings . Example of such variations are given here:

(make-process :null :pipe :pipe "ls" "-al" "/tmp")

(make-process :null :pipe :pipe '("ls" "-al" "/tmp"))

(make-process :null :pipe :pipe #("ls" "-al" "/tmp"))

The first string argument is the full path of the command to execute and is also the argv[0] of the command.

(process? obj)-> <boolean>
Returns #t when obj is a process #f otherwise.

(process-pid proc)-> pid
Returns the process id (pid) of the process.

(process-input proc)-> <port>
(process-output proc)-> <port>
(process-error proc)-> <port>
Returns the port corresponding to the process input, output and error stream. You can use these ports to write or read data to/from the process.

(process-status proc) -> status
Returns the status of a process.

(process-wait proc)-> status
Waits for a process to terminate. If proc is #t, waits for any process to terminate. Returns the exit status of the process. After a process-wait completes, the process does not exist anymore and the ports are closed. You could also access the status of the process with the process-status function.

(process-use-execv flag)-> oldvalue
Determines if processes are created with execv or execvp. When execv is used, first argument must be the full path to the command. When execvp is used, the PATH environment variable is search to find the command. Returns the value of the flag before the call.

Note:
By default, execvp is used.

7.16 Threads

(thread thunk)-> thread
Invoke thunk with no arguments in a new thread. Returns thread, a thread descriptor. When execution of thunk returns, the thread created to invoque thunk terminates.

(thread? obj)-> boolean
Returns #t if obj is a thread descriptor, #f otherwise.

(thread-id thread)-> number
Returns the pthread id associated with thread.

(current-thread)-> thread
Returns the thread descriptor for current thread.

(thread-running? thread)-> boolean
Returns #t if thread is currently running, #f otherwise.

(thread-wait thread)-> #undefined
Wait until thread terminates.

(thread-kill thread)-> #undefined
Terminate thread.

(thread-exit thread)-> #undefined
Terminates current thread. This function never returns.

(thread-dump thread) -> #undefined
Dump the content of a thread. Mostly for debugging purpose.

7.17 Mutexes

A mutex is a MUTual EXclusion device, and is useful for protecting shared data structures from concurrent modifications, and implementing critical sections and monitors.

A mutex has two possible states: unlocked and locked. A mutex can never be owned by two different threads simultaneously. A thread attempting to lock a mutex that is already locked by another thread is suspended until the owning thread unlocks the mutex first.

(make-mutex) -> mutex
Create a new mutex

(mutex? obj) -> boolean
Returns #t if obj is a mutex, #f otherwise

(mutex-lock mutex) -> #undefined
Lock mutex. If mutex is already locked, thread execution is suspended until mutex is unlocked

(mutex-try-lock mutex) -> boolean
Try to lock mutex. If mutex is already locked, #f is returned immediately, otherwise the mutex is locked and #t is returned.

(mutex-unlock mutex) -> #undefined
Unlock mutex

7.18 Semaphores

Semaphores are counters for resources shared between threads. The basic operations on semaphores are: increment the counter atomically, and wait until the counter is non-null and decrement it atomically.

(make-semaphore [value]) -> semaphore
Create a new semaphore object.

(semaphore? object) -> boolean
Returns #t if object is a semaphore, #f otherwise.

(semaphore-wait semaphore) -> #undefined

Suspend the calling thread until semaphore has non-zero count, then decrease the semaphore count.

(semaphore-try-wait semaphore) -> boolean
Non blocking variant of semaphore-wait. If semaphore has non-zero count, the count is atomically decreased and #t is returned. If semaphore count is zero, #f is returned.

(semaphore-post semaphore) -> #undefined
Atomically increases the count of semaphore.

(semaphore-get-value semaphore) -> number
Return the count assiociated to the semaphore.

7.19 Miscellaneous

(apropos string)-> list
Returns a list of known symbols that contains the string.

(whatis string)-> #undefined
Searches the whatis.qs file and displays the definitions of the words matching string. The whatis.qs file is built with the mkwhatis script. The string string may end with a wild card character (#\), in which case all entries beginning with the significant part of string will be returned.

Example of whatis usage :

> (whatis "set") 

(set! VAR EXPR) => VALUE                   [SYNTAX] 

  Evaluates EXPR and stores the resulting value in 

  the location to which VAR is bound.

(set-car! PAIR OBJ) => #undefined           [ R5RS] 

  Stores OBJ in the car field of PAIR.

(set-cdr! PAIR OBJ) => #undefined            [R5RS]  
  Stores OBJ in the cdr field of PAIR.

(set-current-module MODULE) => MODULE     [QScheme] 

  Set MODULE as current module for symbol search.

(set-aux! OBJ VAL) => NULL                [QScheme] 

  Associate a value to the aux pointer of object. 

  THIS IS A DANGEROUS FUNCTION.


next up previous contents
Next: 8 Foreign function interface Up: QScheme Documentation Previous: 6 Expressions   Contents
Daniel Crettol 2000-06-12