Binary integer operations. arithmetic-shift shifts the argument N1 by N2 bits to the left. If N2 is negative, then N1 is shifted to the right. These operations only accept exact integers or inexact integers in word range (32 bit signed on 32-bit platforms, or 64 bit signed on 64-bit platforms).

In safe mode, these procedures throw a type error when given non-float arguments. In unsafe mode, these procedures do not check their arguments. A non-flonum argument in unsafe mode can crash the application.

Note: fpround uses the rounding mode that your C library implements, which is usually different from R5RS.

On the downside, this will result in unnecessarily precise representations of many numbers:

> (flonum-print-precision 17)
> 0.1
0.10000000000000001

The maximum number of decimal digits required to uniquely represent all floating-point numbers of a certain precision is given by the formula ceil(1+N*log10(2)), where N is the number of bits of precision; for double-precision, N=53.

Fetch filename from PORT. This returns the filename that was used to open this file. Returns a special tag string, enclosed into parentheses for non-file ports. PORT defaults to the value of (current-input-port).

Returns the current position of PORT as two values: row and column number. If the port does not support such an operation an error is signaled. This procedure is currently only available for input ports. PORT defaults to the value of (current-input-port).

CHICKEN maintains a global list of features naming functionality available in the current system. Additionally the cond-expand form accesses this feature list to infer what features are provided. Predefined features are chicken, and the SRFIs (Scheme Request For Implementation) provided by the base system: srfi-23, srfi-30, srfi-39. If the eval unit is used (the default), the features srfi-0, srfi-2, srfi-6, srfi-8, srfi-9 and srfi-10 are defined. When compiling code (during compile-time) the feature compiling is registered. When evaluating code in the interpreter (csi), the feature csi is registered.

Keywords are special symbols prefixed with #: that evaluate to themselves. Procedures can use keywords to accept optional named parameters in addition to normal required parameters. Assignment to and bindings of keyword symbols is not allowed. The parameter keyword-style and the compiler/interpreter option -keyword-style can be used to allow an additional keyword syntax, either compatible to Common LISP, or to DSSSL. As long as this parameter is set to #:suffix, Chicken conforms to SRFI-88.

Returns the argument from ARGLIST specified under the keyword KEYWORD. If the keyword is not found, then the zero-argument procedure THUNK is invoked and the result value is returned. If THUNK is not given, #f is returned.

Return a list of all supplied command-line arguments. The first item in the list is a string containing the name of the executing program. The other items are the arguments passed to the application. It depends on the host-shell whether arguments are expanded ('globbed') or not.

Schedules the zero-argument procedures THUNK to be executed before the process exits, either explicitly via exit or implicitly after execution of the last top-level form. Note that finalizers for unreferenced finalized data are run before exit procedures.

Returns a symbol that designates what kind of C runtime library has been linked with this version of the Chicken libraries. Possible return values are static, dynamic or unknown. On systems not compiled with the Microsoft C compiler, c-runtime always returns unknown.

Execute shell command. The functionality offered by this procedure depends on the capabilities of the host shell. If the forking of a subprocess failed, an exception is raised. Otherwise the return status of the subprocess is returned unaltered.

On a UNIX system, that value is the raw return value of waitpid(2), which contains signal, core dump and exit status. It is 0 on success. To pull out the signal number or exit status portably requires POSIX calls, but in a pinch you can use something like this:

Returns the used CPU time of the current process in milliseconds as two values: the time spent in user code, and the time spent in system code. On platforms where user and system time can not be differentiated, system time will be always be 0.

Enables or disables warnings, depending on wether BOOL is true or false. If called with no arguments, this procedure returns #t if warnings are currently enabled, or #f otherwise. Note that this is not a parameter. The current state (whether warnings are enabled or disabled) is global and not thread-local.

Prints error message, writes all extra arguments to the value of (current-error-port) and invokes the current exception-handler. This conforms to SRFI-23. If LOCATION is given and a symbol, it specifies the location (the name of the procedure) where the error occurred.

Returns a list with the call history. Backtrace information is only generated in code compiled without -no-trace and evaluated code. If the optional argument START is given, the backtrace starts at this offset, i.e. when START is 1, the next to last trace-entry is printed, and so on. If the optional argument THREAD is given, then the call-chain will only be constructed for calls performed by this thread.

Prints an appropriate error message to PORT (which defaults to the value of (current-output-port) for the object EXN. EXN may be a condition, a string or any other object. The output is prefixed by the HEADER, which defaults to "Error:".

Invokes a garbage-collection and returns the number of free bytes in the heap. The flag specifies whether a minor (#f) or major (#t) GC is to be triggered. If no argument is given, #t is assumed. An explicit #t argument will cause all pending finalizers to be executed.

Performs a major garbage collection and returns a three element vector containing the total heap size in bytes, the number of bytes currently used and the size of the nursery (the first heap generation). Note that the actual heap is actually twice the size given in the heap size, because CHICKEN uses a copying semi-space collector.

Registers a procedure of one argument PROC, that will be called as soon as the non-immediate data object X is about to be garbage-collected (with that object as its argument). Note that the finalizer will not be called while interrupts are disabled. This procedure returns X.

Finalizers are invoked asynchronously, in the thread that happens to be currently running. Finalizers for data that has become garbage are called on normal program exit. Finalizers are not run on abnormal program exit. A normal program exit does not run finalizers that are still reachable from global data.

Multiple finalizers can be registered for the same object. The order in which the finalizers run is undefined. Execution of finalizers may be nested.

Print statistics after every GC, depending on FLAG. A value of #t shows statistics after every major GC. A true value different from #t shows statistics after every minor GC. #f switches statistics off.

Use uninterned symbols if you need to generate unique values that can be compared quickly, for example as keys into a hash-table or association list. Note that uninterned symbols lose their uniqueness property when written to a file and read back in, as in the example above.

Searches the property list of SYMBOL for the first property with a key in the list PROPERTIES. Returns 3 values: the matching property key, value, and the tail of property list after the matching property. When no match found all values are #f.

PROPERTIES may also be an atom, in which case it is treated as a list of one element.

This procedure can be used to inquire about character names or to define new ones. With a single argument the behavior is as follows: If SYMBOL-OR-CHAR is a symbol, then char-name returns the character with this name, or #f if no character is defined under this name. If SYMBOL-OR-CHAR is a character, then the name of the character is returned as a symbol, or #f if the character has no associated name.

If the optional argument CHAR is provided, then SYMBOL-OR-CHAR should be a symbol that will be the new name of the given character. If multiple names designate the same character, then the write will use the character name that was defined last.

Copies contents of VECTOR1 into VECTOR2. If the argument COUNT is given, it specifies the maximal number of elements to be copied. If not given, the minimum of the lengths of the argument vectors is copied.

Creates and returns a new vector with the contents of VECTOR and length N. If N is greater than the original length of VECTOR, then all additional items are initialized to INIT. If INIT is not specified, the contents are initialized to some unspecified value.

Returns #t if X is a continuation object, or #f otherwise. Please note that this applies only to continuations created by the Continuation API, but not by call/cc, i.e.: (call-with-current-continuation continuation?) returns #f, whereas (continuation-capture continuation?) returns #t.

Returns the setter-procedure of PROCEDURE, or signals an error if PROCEDURE has no associated setter-procedure.

Note that (set! (setter PROC) ...) for a procedure that has no associated setter procedure yet is a very slow operation (the old procedure is replaced by a modified copy, which involves a garbage collection).

When the reader encounters the non-whitespace character CHAR while reading an expression from a given port, then the procedure PROC will be called with that port as its argument. The procedure should return a value that will be returned to the reader:

If CHAR-OR-SYMBOL is a symbol, then a so-called read-mark handler is defined. In that case the handler procedure will be called when a character-sequence of the form #!SYMBOL is encountered.

You can undo special handling of read-syntax by passing #f as the second argument (if the syntax was previously defined via set-read-syntax!).

As a special case, your handler can return zero values, via (values). This causes the reader to completely ignore whatever input you've read, rather than returning some possibly unspecified value. This can be useful in macro context, reading comments, conditional compilation, and so forth. Available in Chicken 4.6.6 and later.

Note that all of CHICKEN's special non-standard read-syntax is handled directly by the reader. To disable built-in read-syntax, define a handler that triggers an error (for example).

Similar to set-sharp-read-syntax!, but intended for defining reader syntax of the form #<NUMBER><CHAR> .... The handler procedure PROC will be called with two arguments: the input port and the number preceding the dispatching character. If the first argument is a symbol, then this procedure is equivalent to set-read-syntax!.