previous up next     contents index
Next: MzLib Library Up: Additional Facilities Previous: Operating System Processes

Miscellaneous Extensions

 

 

(andmap f lists tex2html_wrap_inline8724 ) (procedure)

The arguments are as with map. When an application of f returns #f, then #f is returned; otherwise, the result of the last application of f is returned. If lists are empty, then #t is returned. The procedure f is applied to the items in lists from left to right.

 

(banner) (procedure)

Returns a string for MzScheme's start-up banner text.

 

(collect-garbage) (procedure)

  Forces an immediate garbage collection. Since MzScheme uses a ``conservative'' garbage collector, some unreachable data may remain uncollected (because the collector is not certain that it is unreachable).

 

(current-milliseconds) (procedure)

Returns the current ``time'' in fixnum milliseconds. This time is based on a platform-specific starting date or on the machine's startup time. See also current-seconds and seconds->date.

 

(current-seconds) (procedure)

Returns the current time in seconds. This time is always a positive exact integer based on a platform-specific starting date (with an architecture-specific maximum value). Seconds can be converted into an instance of the (portable) date structure type using  seconds->date, or compared directly with the numerical comparison procedures.

 

(error-print-width n) (procedure)

Sets the number of characters of a value printed by certain primitive error messgaes, notably syntax errors and type errors. If the n argument is omitted, the current error print width is returned.

 

(exit value) (procedure)

Invokes the exit handler (see section 3.15). The default exit handler quits MzScheme with the exit code value. The value argument is optional; the default is 0.

 

(fluid-let bindings expr tex2html_wrap_inline8724 ) (syntax)

The variable names in bindings must already be bound in the environment of the fluid-let expression. Before the expr body is evaluated, the existing bindings are set! to the values specified in bindings. When the expr body returns, the values of the bindings are restored.

 

(format format args tex2html_wrap_inline8722 ) (procedure)

Returns a new string based on format and args using fprintf and a string output port.

 

(fprintf port format args tex2html_wrap_inline8722 ) (procedure)

  Prints formatted output to port, where format is a string that is printed; format can contain special formatting tags:

When an illegal format string is supplied, the  exn:application:type exception is raised. When the format string requires more additional arguments than are supplied, the  exn:application:fprintf:no-argument exception is raised. When more additional arguments are supplied than are used by the format string, the  exn:application:fprintf:extra-arguments exception is raised.

For example,

 
  (fprintf port " tex2html_wrap_inline6770 a as a string is  tex2html_wrap_inline6770 s. tex2html_wrap_inline6770 n" '(3 4) "(3 4)") 
prints this message to port:
 
  (3 4) as a string is "(3 4)". 
followed by a newline.

See also printf and format.

 

(gensym prefix) (procedure)

  Returns a symbol that is not eq?, eqv?, or equal? to any other symbol. The prefix argument is optional; if a string or symbol is provided as prefix, then it is used as a prefix for the generated symbol's printed name. See also string->uninterned-symbol.

 

(getenv name) (procedure)

  Gets the value of an operating system environment variable (Unix and Windows). The name argument must be a string; if an environment variable name exists, its value is returned (as a string); otherwise, #f is returned. See also putenv.

 

(load/cd filename) (procedure)

This is a synonym for load-with-cd.

 

(load-with-cd filename) (procedure)

Sets the current directory to be the directory of filename, loads filename, and then restores the current directory.

 

(ormap f lists tex2html_wrap_inline8724 ) (procedure)

The arguments are as with map. When an application of f returns anything except #f, then that value is returned; otherwise, the result of the last application of f is returned. If lists are empty, then #f is returned. The procedure f is applied to the items in lists from left to right.

 

(primitive? v) (procedure)

Returns #t if v is a built-in primitive procedure or #f otherwise. All R tex2html_wrap_inline6553 RS procedures are primitives, as are most all of the procedures described in this manual. The exceptions are compile-file, format, printf, fprintf, load-with-cd, require-library, and find-executable-path; these are not primitive.

 

(primitive-name prim) (procedure)

Returns the name of the primitive procedure prim as a symbol.

 

(printf format args tex2html_wrap_inline8722 ) (procedure)

Calls fprintf with the current output port.

 

(promise? v) (procedure)

Returns #t if v is a promise (created with delay) or #f otherwise.

 

(putenv name value) (procedure)

  Sets the value of an operating system environment variable. The name and value arguments must be strings; the environment variable name is set to value. The return value is #t if the assignment succeeds, or #f otherwise. See also getenv.

 

(random n) (procedure)

Returns a random integer in the range 0 to tex2html_wrap_inline7192 . The n argument must be a positive fixnum integer.

 

(random-seed n) (procedure)

Seeds the random number generator. The n argument must be a fixnum integer.

 

(read-eval-print-loop) (procedure)

Starts a new read-eval-print loop using the current input, output, and error ports. The default error escape procedure does not exit a read-eval-print loop.

 

(read-line port) (procedure)

Returns a string containing the next line of characters from port. If port is not specified, the current input port is used. Characters are read from port until a carriage-return, a line-feed, and an end-of-file is read. The carriage-return or line-feed is not returned in the result string. If no characters are available from the port, eof is returned.

 

(seconds->date seconds) (procedure)

Takes seconds, a platform-specific value returned by  current-seconds or  file-modify-seconds, and returns an instance of the  date structure type with the following fields:

The value returned by  current-seconds or  file-modify-seconds is not portable among platforms. Convert a time in seconds to a date structure when portability is needed.

 

(secure-primitive-exception-types) (procedure)

Undefines all of the primitive exception structure type values and constructors, so that all new primitives exception values can only be generated by the system. The structure predicates and selectors are not affected.

 

(string->uninterned-symbol s) (procedure)

  Like  string->symbol, but the resulting symbol is a new uninterned symbol; i.e., it is not a symbol that can be expressed as a quoted constant, although its printed form looks the same as the symbol returned by string->symbol for the same input.

 

(syntax? v) (procedure)

Returns #t if its argument is a primitive syntax value or #f otherwise. Note that syntax? cannot be applied directly to syntax identifiers, but syntax values can be obtained indirectly with  global-defined-value.

 

(system-type) (procedure)

Returns a symbol indicating the type of the operating system for a running MzScheme. The possible values are

Future ports of MzScheme will expand this list of system types.

 

(time expr) (syntax)

Times the evaluation of expr.

 

(time-apply thunk) (procedure)

The procedure thunk is invoked with no arguments. Three values are returned: the result of applying thunkgif, the number of milliseconds of CPU time required to obtain this result, and the number of ``real'' milliseconds required for the result.

The reliability of the timing numbers depends on the operating system. If multiple MzScheme threads are running, then the reported time may include work performed by other threads.

 

(version) (procedure)

Returns a string representing the currently executing version of MzScheme.



previous up next     contents index
Next: MzLib Library Up: Additional Facilities Previous: Operating System Processes

PLT