Catalog of Language Elements # - C
Catalog of Language Elements D - L
Category | Special form | ||||||
Format |
|
||||||
Parameters |
|
||||||
Description | macro creates a new special form with keyword
var. When compiling an expression whose first subexpression is a symbol and this symbol is bound by an macro definition, the entire expression (unevaluated) is bound to the parameter arg and the expri are evaluated in order from left to right. The last expri should evaluate to another expression, which is compiled instead of the original expression. As macro expansions can't be interrupted by the Break button for technical reasons, there are two limits:
macro-definitions are allowed at top-level only, not inside other expressions. Macros may be recursive. The return value of a macro definition is #n in this implementation. | ||||||
R4RS Compliance | LispMe extension, but according to several other macro systems | ||||||
Examples |
|
Category | Primitive procedure | ||||||
Format | (macro? obj) | ||||||
Parameters |
|
||||||
Description | macro? returns #t for a macro created by the macro special form and #f for any other object. | ||||||
R4RS Compliance | Full | ||||||
Examples |
|
Category | Primitive procedure (MathLib required) | |||||||||
Format | (magnitude z) | |||||||||
Parameters |
|
|||||||||
Description | magnitude computes the magnitude (or absolute value) of the number z. | |||||||||
R4RS Compliance | Full | |||||||||
Examples |
|
Category | Primitive procedure (MathLib required) | ||||||
Format | (make-polar mag ang) | ||||||
Parameters |
|
||||||
Description | make-polar constructs a complex number from the magnitude mag and the angle ang. | ||||||
R4RS Compliance | Full | ||||||
Examples |
|
Category | Primitive procedure (MathLib required) | ||||||
Format | (make-rectangular re im) | ||||||
Parameters |
|
||||||
Description | make-rectangular constructs a complex number from the real part re and the imaginary part re. | ||||||
R4RS Compliance | Full | ||||||
Examples |
|
Category | Primitive procedure | ||||
Format | (make-string len char) | ||||
Parameters |
|
||||
Description | make-string creates a newly allocated string of length len, where each character is initialized to char. | ||||
R4RS Compliance | Fill char is required | ||||
Examples |
|
Category | Primitive procedure | ||||
Format | (make-vector len fill) | ||||
Parameters |
|
||||
Description | make-vector creates a newly allocated vector of length len, where each element is initialized to fill. | ||||
R4RS Compliance | Fill value is required | ||||
Examples |
|
Category | Library procedure | ||||
Format | (map proc list) | ||||
Parameters |
|
||||
Description | map creates a newly allocated lists, where each element is the result of applying proc to the corresponding element of list. | ||||
R4RS Compliance | Supports only one list | ||||
Examples |
|
Category | Library procedure | ||||||
Format | (max comp1 comp2 ...) | ||||||
Parameters |
|
||||||
Description | max returns the largest of some objects, according to the > procedure. Note that max handles chars and strings, too. At least one object must be specified. | ||||||
R4RS Compliance | Full and works for strings and characters, too. | ||||||
Examples |
|
Category | Library procedures | ||||||||||||
Formats |
|
||||||||||||
Parameters |
|
||||||||||||
Description | These procedures return the first sublist of list, whose car is obj. If none is found, #f is returned. To compare obj with the car, member uses equal?, memq uses eq?, and memv uses eqv?. | ||||||||||||
R4RS Compliance | Full | ||||||||||||
Examples |
|
Category | UI event | ||
Format | (menu id) | ||
Parameters |
|
||
Description | menu is the event posted when the user has selected a menu item or invoked a menu command by a command stroke shortcut. |
Category | Primitive procedure | |||
Format | (message obj) | |||
Parameters |
|
|||
Description | message prints obj using display to a message box (see User message). The return value is #n. | |||
R4RS Compliance | LispMe extension | |||
Examples |
|
Category | Library procedure | ||||||
Format | (min comp1 comp2 ...) | ||||||
Parameters |
|
||||||
Description | min returns the smallest of some objects, according to the < procedure. Note that min handles chars and strings, too. At least one object must be specified. | ||||||
R4RS Compliance | Full and works for strings and characters, too. | ||||||
Examples |
|
Category | Library procedure | |||||||||||||||
Format | (modulo int1 int2) | |||||||||||||||
Parameters |
|
|||||||||||||||
Description | modulo divides two integer numbers and returns the remainder. The sign of the result is always the sign of the divisor, in contrast to remainder. Division by zero is an error. | |||||||||||||||
R4RS Compliance | Full | |||||||||||||||
Examples |
|
Category | Library procedure | ||||||
Format | (negative? num) | ||||||
Parameters |
|
||||||
Description | negative? returns #t, if num is negative. Otherwise it returns #f. See also positive? and zero?. | ||||||
R4RS Compliance | Full | ||||||
Examples |
|
Category | Library procedure | |||
Format | (newline [outport]) | |||
Parameters |
|
|||
Description | newline prints a linefeed character to the output field or to the output port outport. newline returns the line feed character. For related information, see display and write. | |||
R4RS Compliance | Full | |||
Examples |
|
Category | Primitive procedure | ||||||
Format | (none? obj) | ||||||
Parameters |
|
||||||
Description | none? returns #t for #n and #f for any other object. | ||||||
R4RS Compliance | LispMe extension | ||||||
Examples |
|
Category | Primitive procedure | |||||||||
Format | (not obj) | |||||||||
Parameters |
|
|||||||||
Description | not returns #t if obj is false, otherwise it returns #t. Remember that in LispMe () and #f are distinct objects, so not is not the same procedure as null?. | |||||||||
R4RS Compliance | Full | |||||||||
Examples |
|
Category | Primitive procedure | |||||||||
Format | (null? obj) | |||||||||
Parameters |
|
|||||||||
Description | null? returns #t for the empty list () and #f for any other object. Remember that in LispMe () and #f are distinct objects, so null? is not the same procedure as not. | |||||||||
R4RS Compliance | Full | |||||||||
Examples |
|
Category | Primitive procedure | ||||||||||||
Format | (number? obj) | ||||||||||||
Parameters |
|
||||||||||||
Description | number? returns #t for integer, real and complex numbers and #f for any other object. | ||||||||||||
R4RS Compliance | Full | ||||||||||||
Examples |
|
Category | Primitive procedure | |||||||||||||||
Format | (object->string obj) | |||||||||||||||
Parameters |
|
|||||||||||||||
Description | object->string uses the standard LispMe printer to build the textual representation of obj as a string. The printing convention of write is used. The resulting string is truncated to 4096 characters. | |||||||||||||||
R4RS Compliance | LispMe extension. object->string subsumes R4RS procedures symbol->string and number->string. | |||||||||||||||
Examples |
|
Category | Library procedure | ||||||
Format | (odd? int) | ||||||
Parameters |
|
||||||
Description | odd? returns #t, if int is odd. Otherwise it returns #f. See also even?. | ||||||
R4RS Compliance | Full | ||||||
Examples |
|
Category | Primitive procedure | |||
Format | (open-append-file string) | |||
Parameters |
|
|||
Description | open-append-file searches a memo with name string and opens it for output, which will be appended to its former contents. If the memo doesn't exist, a new one is created like by open-output-file For more information about files/memos see here. | |||
R4RS Compliance | LispMe extension | |||
Examples |
|
Category | Primitive procedure | |||
Format | (open-input-file string) | |||
Parameters |
|
|||
Description | open-input-file searches a memo with name string and returns the input port associated with the opened memo. If the memo doesn't exist, an error is raised. | For more information about files/memos see here.|||
R4RS Compliance | Full | |||
Examples |
|
Category | Primitive procedure | |||
Format | (open-output-file string) | |||
Parameters |
|
|||
Description | open-output-file creates a new memo with name string and returns the output port associated with the new memo. For more information about files/memos see here. | |||
R4RS Compliance | Full | |||
Examples |
|
Category | Special form | |||||||||
Format | (or expr1 ...) | |||||||||
Parameters |
|
|||||||||
Description | or evaluates the expri in left to right order. If any expression is true, the evaluation is finished. In any case, the value of the last expression evaluated is returned. Remember that '() is considered true in LispMe. | |||||||||
R4RS Compliance | Full | |||||||||
Examples |
|
Category | Primitive procedure | |||||||||
Format | (output-port? obj) | |||||||||
Parameters |
|
|||||||||
Description | output-port? returns #t for a port opened for output by open-output-file and #f for any other object. | |||||||||
R4RS Compliance | Full | |||||||||
Examples |
|
Category | Primitive procedure | |||
Format | (own-gui switch) | |||
Parameters |
|
|||
Description | When switch is true, most controls and
fields in LispMe's main dialog
are set unusable, so that they won't respond to events and you can
handle events by yourself. The only exception is the
break button which is never
disabled to allow interrupting the process. When switch is false, LispMe's main dialog responds to events as usual. The return value is switch. |
|||
R4RS Compliance | LispMe extension | |||
Examples |
|
Category | Primitive procedure | |||||||||
Format | (pair? obj) | |||||||||
Parameters |
|
|||||||||
Description | pair? returns #t for a non-empty list (a cons-cell) and #f for any other object. | |||||||||
R4RS Compliance | Full | |||||||||
Examples |
|
Category | Primitive procedure | |||
Format | (peek-char inport) | |||
Parameters |
|
|||
Description | peek-char reads ahead the next character from the input port inport and returns it, but doesn't advance the input position. If the end of file is reached, a unique end-of-file object (which is recognized by eof-object?) is returned. | |||
R4RS Compliance | The port parameter is not optional. | |||
Examples |
|
Category | UI event | ||||
Format | (pen-down x y) | ||||
Parameters |
|
||||
Description | pen-down is the first event posted when the user taps the screen with the pen. This event normally causes other events like lst-enter afterwards. |
Category | UI event | ||||
Format | (pen-move x y) | ||||
Parameters |
|
||||
Description | pen-move is the event posted when the user moves the pen across the screen. Some kinds of UI element track pen movement by themselves, so you won't see this event. |
Category | UI event | ||||
Format | (pen-up x y) | ||||
Parameters |
|
||||
Description | pen-up is the event posted when the user lifts the pen from the screen. Some kinds of UI element track pen lifting by themselves, so you won't see this event. |
Category | UI event | ||||||||
Format | (pop-select pid lid newsel oldsel) | ||||||||
Parameters |
|
||||||||
Description | pop-select is the event posted when the user has selected an item in a popup list. |
Category | Library procedure | |||||||||
Format | (port? obj) | |||||||||
Parameters |
|
|||||||||
Description | port? returns #t for an input port or an output port and #f for any other object. | |||||||||
R4RS Compliance | Full | |||||||||
Examples |
|
Category | Library procedure | ||||||
Format | (positive? num) | ||||||
Parameters |
|
||||||
Description | positive? returns #t, if num is positive. Otherwise it returns #f. See also negative? and zero?. | ||||||
R4RS Compliance | Full | ||||||
Examples |
|
Category | Primitive procedure | |||||||||
Format | (procedure? obj) | |||||||||
Parameters |
|
|||||||||
Description | procedure? returns #t for a procedure and #f for any other object. Procedures include both closures returned by lambda and continuations created with call/cc | |||||||||
R4RS Compliance | Full | |||||||||
Examples |
|
Category | Primitive procedure | ||||||||||||
Format | (promise? obj) | ||||||||||||
Parameters |
|
||||||||||||
Description | promise? returns #t for a promise returned by delay and #f for any other object. It doesn't matter, if the promise has already been forced. | ||||||||||||
R4RS Compliance | Full | ||||||||||||
Examples |
|
Category | Special form | |||||||||
Format |
|
|||||||||
Parameters |
|
|||||||||
Description | quasiquote returns template unevaluated,
if it doesn't contain any of the special forms
unquote or
unquote-splicing. If a comma (called an unquote expression) appears within template, the expression following it is evaluated and the result is inserted into the template instead of the unquote expression. If an at-sign immediately follows the comma (called an unquote-splicing expression) the expression must evaluate to a list and its elements are inserted into the template instead of the unquote-splicing expression. quasiquote forms can be nested. Substitutions are made only for unquoted expressions at the same nesting level of the outermost quasiquote. The nesting level increases in each quasiquote and decreases in each unquotation. In contrast to quote, the structure returned is always newly allocated. quasiquote may be abbreviated with a back apostrophe `. The Graffiti stroke for this is "dot, stroke north-west and back". |
|||||||||
R4RS Compliance | Full | |||||||||
Examples |
|
Category | Special form | |||||||||
Format |
|
|||||||||
Parameters |
|
|||||||||
Description | quote returns obj unevaluated. Use quote to imbed constants in your code. quote may be abbreviated with a single apostrophe ' | |||||||||
R4RS Compliance | Full | |||||||||
Examples |
|
Category | Primitive procedure | |||||||||
Format | (quotient int1 int2) | |||||||||
Parameters |
|
|||||||||
Description | quotient divides two integer numbers truncating the result to an integer. Division by zero is an error. | |||||||||
R4RS Compliance | Full | |||||||||
Examples |
|
Category | Primitive procedure | ||||||||||||
Format | (random int) | ||||||||||||
Parameters |
|
||||||||||||
Description | random generates a random number in the range [0..abs(int)-1]. int may not be 0 or an error results. | ||||||||||||
R4RS Compliance | LispMe extension | ||||||||||||
Examples |
|
Category | Primitive procedure | |||
Format | (read inport) | |||
Parameters |
|
|||
Description | read reads an object from the input port inport. It uses the standard LispMe parser to create an object from its textual representation, so all kind of syntax errors are possible. In this case, the input position of inport is not advanced. The type of the object is solely determined by the data input. If the end of file is found while reading, a unique end-of-file object (which is recognized by eof-object?) is returned. | |||
R4RS Compliance | The port parameter is not optional. Use input to let the user input an expression. | |||
Examples |
|
Category | Primitive procedure | |||
Format | (read-char inport) | |||
Parameters |
|
|||
Description | read-char reads a single characters from the input port inport and returns it. If the end of file is found while reading, a unique end-of-file object (which is recognized by eof-object?) is returned. | |||
R4RS Compliance | The port parameter is not optional. | |||
Examples |
|
Category | Primitive procedure | |||
Format | (read-line inport) | |||
Parameters |
|
|||
Description | read-line reads successive characters from the input port inport until a line feed is encountered and returns all chars read as a string. If the end of file is found while reading, a unique end-of-file object (which is recognized by eof-object?) is returned. | |||
R4RS Compliance | LispMe extension. Use input-string to let the user input a string. | |||
Examples |
|
Category | Primitive procedure | ||||
Format | (read-record dbname recnum) | ||||
Parameters |
|
||||
Description | read-record opens the Pilot database named dbname (case-sensitive!) and reads the record with index recnum from there. The record is returned as a string. If either the database or the index doesn't exist, #f is returned. | ||||
R4RS Compliance | LispMe extension. | ||||
Examples |
|
Category | Primitive procedure | ||||
Format | (read-resource restype resid) | ||||
Parameters |
|
||||
Description | read-resource searches all open resource databases
for a resource of type restype
with resource id resid and returns it
as a string. If the resource is not found,
#f is returned. Searched resource databases are
|
||||
R4RS Compliance | LispMe extension. | ||||
Examples |
|
Category | Primitive procedure | |||||||||
Format | (real-part z) | |||||||||
Parameters |
|
|||||||||
Description | real-part computes the real part of the number z. | |||||||||
R4RS Compliance | Full | |||||||||
Examples |
|
Category | Primitive procedure | ||||||||||||
Format | (real? obj) | ||||||||||||
Parameters |
|
||||||||||||
Description | real? returns #t for integer and real numbers and #f for any other object. | ||||||||||||
R4RS Compliance | Full | ||||||||||||
Examples |
|
Category | Primitive procedure | ||||||
Format | (rect x y radius) | ||||||
Parameters |
|
||||||
Description | rect draws a filled rectangle from the current point
stored in
*gstate*
to (x,y)
using the colors, drawing pattern and drawing mode stored in
*gstate*.
radius is
used for rectangles with rounded corners, it specifies the radius
of a circle by which the corners are rounded. To draw a plain
rectangle, use 0 for radius.
After that, the current point is updated
to (x,y). See here for details on the graphic state. The return value is #n to avoid trashing the graphics. |
||||||
R4RS Compliance | LispMe extension | ||||||
Examples |
|
Category | Primitive procedure | |||||||||||||||
Format | (remainder int1 int2) | |||||||||||||||
Parameters |
|
|||||||||||||||
Description | remainder divides two integer numbers and returns the remainder. The sign of the result is always the sign of the dividend (or 0), in contrast to modulo. Division by zero is an error. | |||||||||||||||
R4RS Compliance | Full | |||||||||||||||
Examples |
|
Category | Library procedure | ||||||
Format | (reverse list) | ||||||
Parameters |
|
||||||
Description | reverse creates a newly allocated list consisting of the elements of list in reverse order. | ||||||
R4RS Compliance | Full | ||||||
Examples |
|
Category | Primitive procedure | ||||||
Format | (rgb->index r g b) | ||||||
Parameters |
|
||||||
Description | rgb->index searches the system colortable (palette)
for a color matching the given r g b values. The
algorithm is described in the SDK docs: Palm OS SDK Reference Palm OS 3.5 supports a maximum of 256 colors. The number of possible RGB colors greatly exceeds this amount. For this reason, an exact match may not be available. If there is no exact RGB match, then a luminance best-fit is used if the color lookup table is entirely gray scale (red, green, and blue values for each entry are identical), or a shortest-distance fit in RGB space is used if the palette contains colors. RGB shortest distance may not always produce the actual closest perceptible color, but it's relatively fast and works for the system palette. The result is an integer denoting the best palette entry. On systems running older OS versions than 3.5, 0 is returned. |
||||||
R4RS Compliance | LispMe extension | ||||||
Examples |
|
Category | Primitive procedure (MathLib required) | ||||||
Format | (round num) | ||||||
Parameters |
|
||||||
Description | round converts num to a floating point number and returns the closest whole number. The result is not a LispMe integer, it's a floating point value. | ||||||
R4RS Compliance | Full | ||||||
Examples |
|