# LispMe-language-elements

Here is a categorized list of LispMe Language Elements (primitive procedures, library procedures, special forms, globals and constants). The categorization is still a work in progress.

This list should be applicable to most other R4RS Scheme implementations, with a few exceptions, one of them being "macro", which may, or may not be defined in the scheme of your choice. If you find a lisp-me or palm specific function/special form in the first section, please mark it or move it below.

edit-hint: I am just a beginner, so this list should be viewed as anything but authoritative at this point...

## R4RS Compliant

### Math

#### Operations

• + - Add
• - - Subtract
• * - Multiply
• / - divide
• divide - divides two integers returning both quotient and remainder.
• exp - computes the natural antilogarithm of a number.
• expt - computes the power of two numbers.
• log - computes the natural logarithm of a number.
• log10 - computes the base 10 logarithm of a number.
• max - returns the largest of some objects.
• min - returns the smallest of some objects.
• modulo - divides two integers and returns the remainder.
• quotient - divides two integers ignoring the remainder.
• random - generates a random integer.
• remainder - divides two integers and returns the remainder.
• sqrt - computes the square root of a number.

#### Trig

• acos - computes the arc cosine of a number.
• acosh - computes the hyperbolic arc cosine of a number.
• asin - computes the arc sine of a number.
• asinh - computes the hyperbolic arc sine of a number.
• atan - computes the arc tangent of its argument(s).
• atanh - computes the hyperbolic arc tangent of a number.
• cos - computes the cosine of a number.
• cosh - computes the hyperbolic cosine of a number.
• sin - computes the sine of a number.
• sinh - computes the hyperbolic sine of a number.
• tan - computes the tangent of a number.
• tanh - computes the hyperbolic tangent of a number.

#### Rounding and Mangling

• abs - computes the absolute value of a number.
• ceiling - computes the smallest whole number greater than or equal to a number.
• floor - computes the largest whole number less than or equal to a number.
• round - rounds a number to the closest integer.
• truncate - computes the integer component of a number.

#### Numeric Predicates

• complex? - recognizes complex numbers.
• even? - tests, if a number is even.
• exact? - tests if a number is exact.
• inexact? - tests if a number is inexact.
• integer? - recognizes integer numbers.
• negative? - tests, if a number is negative.
• number? - recognizes numbers.
• odd? - tests, if a number is odd.
• positive? - tests, if a number is positive.
• real? - recognizes real numbers.
• zero? - tests if a number is equal to zero.

#### Reals

• exact->inexact - converts an exact number to an inexacts one.
• inexact->exact - converts a (real) number to integer.
• real? - recognizes real numbers.

#### Integers

• inexact->exact - converts a (real) number to integer.
• integer - converts a number to integer.
• integer->char - creates a character from its ASCII code.
• integer? - recognizes integer numbers.

#### Complex Numbers

• angle - computes angle (or argument) of a complex number.
• complex? - recognizes complex numbers.
• conjugate - computes the conjugate of a complex number.
• imagpart - computes the imaginary part
• magnitude - computes the magnitude
• make-polar - constructs a complex number from a
• make-rectangular - constructs a complex number from the
• realpart - computes the real part.

### Comparison

• < - , <=, >, and >=
• = - tests if a two numbers are equal.
• eq? - recognizes identical objects. (symbols, integers or chars)
• equal? - recognizes objects with the same value. (symbols, numbers, vectors, strings.)
• eqv? - recognizes equivalent objects. (not strings)

### Bitwise

• bit-and - bitwise ands its arguments.
• bit-not - bitwise complements its argument.
• bit-or - bitwise ors (inclusive) its arguments.
• bit-shift - bitwise shifts its argument.
• bit-xor - bitwise ors (exclusive) its arguments.

### Boolean

• and - is the nonstrict logical conjunction of expressions.
• boolean? - recognizes #t and #f.
• not - negates a boolean value.
• or - is the nonstrict logical disjunction of expressions.
• #f - is the value <i>false</i>.
• #t - is the canonical value <i>true</i>.

### Strings

• make-string - creates a new string.
• strarr-length - counts the strings in a string array.
• strarr-ref - returns a string from a string array by index.
• string->list - converts a string to the list of its characters.
• string->object - parses a string as a LispMe object.
• string-append - concatenates strings.
• string-length - counts the characters in a string.
• string-lower - converts a string to lower case.
• string-ref - returns a character in a string by index.
• string-set! - replaces a character in a string.
• string-tokenize - splits a string into a list on separator chars.
• string=? - compares two strings.
• string? - recognizes strings.
• substring - returns s substring of a string.
• object->string - prints an object to a string.

### Lists

• append - concatenates lists.
• apply - applies a procedure to arguments given as a list.
• assoc - searches key-value lists for key using equal?
• assq - searches key-value lists for key using eq?
• assv - searches key-value lists for key using eqv?
• car - returns the car component of a pair.
• cdr - returns the cdr component of a pair.
• circular? - recognizes circular lists.
• cons - creates a freshly allocated pair.
• length - returns the length of a list.
• list - creates a proper list from its arguments.
• list* - creates a list from its arguments.
• list->string - converts a list of characters to a string.
• list->vector - converts a list to a vector.
• list-ref - returns an element of a list by index.
• list-tail - returns a cons cell of a list by index.
• list? - recognizes proper lists.
• map - applies a procedure to each element of a list.
• member - returns the first subset of a list whos car is equal?
• memq - returns the first subset of a list whos car is eq?
• memv - returns the first subset of a list whos car is eqv?
• null? - recognizes the empty list.
• pair? - recognizes a cons cell.
• position - returns the index (uses equal?)
• posq - returns the index (uses eq?)
• posv - returns the index (uses eqv?)
• assoc - searches key-value lists for val using equal?
• assq - searches key-value lists for val using eq?
• assv - searches key-value lists for val using eqv?
• reverse - reverses a list.
• set-car! - modifies the car component of a pair.
• set-cdr! - modifies the cdr component of a pair.
• '() - is an empty list.

### Vectors

• make-vector - creates a new vector.
• vector - creates a vector from its arguments.
• vector->list - converts a vector to a list.
• vector-length - counts the elements in a vector.
• vector-ref - returns an element of a vector by index.
• vector-set! - modifies an element in a vector.
• vector? - recognizes vectors.

### Declaration, Binding and Modification

• define - associates names with values.
• let - binds local variables for expressions.
• let* - binds local variables in sequence for expressions.
• letrec - evaluates expressions in an environment with mutual
• pset! - modifies several variables in parallel.
• set! - modifies a variable.

### Flow Control

• begin - sequentially evaluates expressions.
• call/cc - calls a procedure with the current continuation
• case - tests a value against some constant lists and
• cond - sequentially tests conditions and evaluates expressions
• continuation? - recognizes continuations.
• delay - creates a promise.
• do - is a general looping construct.
• disasm - disassembles a closure.
• eval - evaluates an expression
• for-each - applies a procedure to each element of a list.
• force - evaluates a promise.
• if - conditionally evaluates one of two expressions.
• it - contains the result of the last evaluation.
• lambda - creates a procedure.
• procedure? - recognizes procedures.
• promise? - recognizes promises.
• while - executes instructions in a loop.
• wait - waits for a time given.

### Date and Time

• current-ticks - returns the current ticks value.
• current-ts - returns the current timestamp.
• date+ - adds a number of days to a date.
• date-day - extracts the day from a date.
• date-diff - computes the difference between two dates.
• date-month - extracts the month from a date.
• date-time - gets the current date and time.
• date-year - extracts the year from a date.
• date? - recognizes dates.
• day-of-week - extracts the day of week from a date.
• make-date - creates a date value.
• make-time - creates a time value.
• make-ts - creates a timestamp.
• time? - recognizes times.
• time-hour - extracts the hour from a time.
• time-hour - extracts the hour from a time.
• ts->date - extracts the date parts from a timestamp.
• ts->number - extracts the second count from a timestamp.
• ts->time - extracts the time parts from a timestamp.
• ts-second - extracts the seconds from a timestamp.
• ts? - recognizes timestamps.

### Macros and Quoting

• macro? - recognizes macros.
• quasiquote - builds (almost) constant objects.
• quote - quotes a symbol
• unquote - evaluates an expression in a quasiquote template.
• unquotesplicing - evaluates an expression in a quasiquote template
• ' - quote
• ` - quasiquote
• , - unquote
• ,@ - unquote-splicing

### IO

• close-input-port - closes an open input port.
• close-output-port - closes an open output port.
• display - prints an object in humanreadable format.
• eof-object? - recognizes the endoffile object.
• newline - starts a new line.
• input-port? - recognizes a port opened for input.
• output-port? - recognizes a port opened for output.
• open-output-file - opens a new memo for output.
• peekchar - returns the next character from an input port.
• port? - recognizes any port.
• read - parses data read from an input port.
• readchar - reads a single character from an input port.
• readline - reads a line of text from an input port.
• text - prints an object as graphic text.
• write - prints an object in machinereadable format.

### Misc/Unknown

• symbol? - recognizes symbols.
• gensym - creates a new unique symbol.

## Palm Specific

### Misc

• batteryinfo - lists information about the current battery status.
• close-net-lib - closes the net library.
• crash - causes a fatal exception.
• error - aborts the evaluation with an error message.
• get-clipboard-text - retrieves the system clipboard.
• get-sys-pref - retrieves a value from the system preferences.
• hotsync-info - lists information about the HotSync status.
• launch - starts another Palm application.
• lookup-host - resolves a symbolic hostname.
• make-str-arr - creates a PalmOS string array.
• none? - recognizes the nonprinting object.
• rom-version - returns the version number of the PalmOS ROM.
• set-clipboard-text - sets the system clipboard.
• set-res-db - sets the name of the resource DB for the user interface.
• set-sys-pref - sets a value in the system preferences.
• sound - plays a (pseudo)musical sound.
• #n - is a value, which does not print.
• *hist* - contains the last expressions evaluated.
• *resdb* - contains the current resource database.

**Palm Date and Time

• set-ticks! - updates a ticks value.
• ticks? - recognizes ticks.
• ticks-per-sec - returns the number of ticks in a second.
• ticks-since - returns the number of ticks elapsed.

### GUI

#### Event

• event - gets an user interface event.
• own-gui - switches eventhandling of LispMe's dialog.
• timeout - is posted when no event has arrived in time.
• waitpen - waits for a pen tap and returns its coordinates.

#### Events

• ctl-enter - is posted when a control is tapped.
• ctl-repeat - is posted when a repeating button "fires".
• ctl-select - is posted when a control is selected.
• fld-changed - is posted when a field is scrolled by dragselection.
• fld-enter - is posted when a field is tapped.
• frm-close - is posted when a form is closed.
• frm-open - is posted when a form is opened.
• frm-title-enter - is posted when a form title is tapped.
• frm-title-select - is posted when a form title has been selected.
• frm-update - is posted when a form has to be updated.
• key-down - is posted when a graffiti char is entered.
• lst-enter - is posted when a list is tapped.
• lst-select - is posted when a list item has been selected.
• menu - is posted when a menu item has been selected.
• pen-down - is posted when the pen touches the screen.
• pen-move - is posted when the pen is moved on the screen.
• pen-up - is posted when the pen is lifted from the screen.
• pop-select - is posted when an item in a popuplist has been selected.
• scl-exit - is posted when a scrollbar has been released.
• scl-repeat - is posted when a scrollbar is dragged.

#### Direct to Screen Drawing

• bitmap - draws a bitmap.
• draw - draws a line.
• index->rgb - retrieves the actual RGB values for a palette entry.
• move - moves the graphics cursor.
• rect - draws a filled rectangle.
• rgb->index - finds the nearest palette entry for a color.
• set-palette - modifies a palette entry.
• *gstate* - contains the entire graphics state.

#### Forms and Dialogs

• frm-alert - displays a PalmOS alert.
• frm-get-focus - gets the UI element having the focus.
• frm-get-prop - gets the form's property list.
• frm-goto - closes the current form and displays a new one.
• frm-help - display a help string.
• frm-popup - displays a new form, but doesn't close the old one.
• frm-return - closes the current form and jumps to its continuation.
• frm-set-focus - sets the focus to a UI element.
• frm-show - shows/hides a UI element.
• message - displays a message box.
• pick-color - displays the system dialog for selecting a color.
• pick-date - displays the system dialog for selecting a date.
• pick-time - displays the system dialog for selecting a time.
• pick-time-range - displays the system dialog for selecting a time range.

#### UI Elements

• ctl-get-label - returns the label of a UI control.
• ctl-get-val - returns the value of a UI control.
• ctl-hit - simulates tapping a UI control.
• ctl-set-label - sets the label of a UI control.
• ctl-set-val - sets the value of a UI control.
• fld-copy - copies text from a UI field to the clipboard.
• fld-cut - cuts text from a UI field to the clipboard.
• fld-dirty? - returns if a field has been modified.
• fld-get-scroll - returns scroll parameters for a UI field.
• fld-get-text - returns the text of a UI field.
• fld-paste - pastes text from the clipboard into a UI field.
• fld-scroll - scrolls a UI field.
• fld-set-dirty - sets the dirty flag of a UI field.
• fld-set-text - sets the text of a UI field.
• fld-undo - undoes the last change to a UI field.
• lst-get-sel - returns the selected item in a UI list.
• lst-get-text - returns a specified item text of a UI list.
• lst-set-list - fills a UI list with a list of items.
• lst-set-sel - selects an item in a UI list.
• scl-get-val - returns the values of a scrollbar.
• scl-set-val - sets the values of a UI scrollbar.

### Palm IO

#### Buffering

(insert buffering functions here)

#### Memo Database

• delete-file - deletes a memo.
• dir - returns a list of all memos in the MemoPad database.
• open-append-file - opens an existing memo for appending output.
• open-input-file - opens an existing memo for input.

#### Arbitrary Pilot Database

• dbref? - recognizes databases.
• delete-record - deletes a record in an arbitrary Pilot DB.
• dm-archive-rec - marks a record as archived in an open database.
• dm-close-db - closes an open Pilot database.
• dm-create-db - creates a new Pilot database.
• dm-db-info - retrieves general database information.
• dm-db-list - lists all databases of a specified type and creator.
• dm-db-size - retrieves database size information.
• dm-delete-db - deletes an arbitrary Pilot database.
• dm-delete-rec - marks a record as deleted in an open database.
• dm-get-rec-attr - gets the attributes of a database record.
• dm-insert-rec - inserts a new record into an open database.
• dm-insert-rsrc - inserts a new resource into an open database.
• dm-num-recs - counts the records in a database.
• dm-open-db - opens an arbitrary Pilot database.
• dm-read-rec - reads a record from an arbitrary database.
• dm-read-rsrc - reads a resource from any open resource database.
• dm-remove-rec - (physically) removes a record from an open database.
• dm-remove-rsrc - removes a resource from an open database.
• dm-rsrcdb? - distinguishes record from resource databases.
• dm-set-rec-attr - sets the attributes of a database record.
• dm-update-rec - updates an existing record in an open database.
• dm-update-rsrc - updates an existing resource in an open database.
• read-record - reads a record from an arbitrary Pilot DB.
• read-resource - reads a resource from any open resource DB.
• write-record - writes a record to an arbitrary Pilot DB.

#### Serial

• close-serial - closes an open serial port.
• new-serial? - tests, if the New Serial Manager is available.
• ope-nserial - opens a serial port.
• serial-get-cts - gets the CTS timeout for a serial device.
• serial-get-timeout - gets the receive timeout for a serial device.
• serial-info - returns information for a serial device.
• serial-input - returns the input port to read from a serial device.
• serial-number - returns the serial number of the Palm device.
• serial-output - returns the output port to write to a serial device.
• serial-receive-flush - flushes the receive buffer of a serial device.
• serial-send-flush - flushes the send buffer of a serial device.
• serial-set-break! - controls the break signal on a serial device.
• serial-set-cts! - sets the CTS timeout for a serial device.
• serial-set-irda! - enables/disables IrDA connection for a serial device.
• serial-set-rx! - enables/disables the IrDA receiver for a serial device.
• serial-set-timeout! - sets the receive timeout for a serial device.
• serial-status - returns the status of a serial device.
• serial? - recognizes serial ports.

#### Sockets

• make-client-socket - creates a client socket.
• socket-down? - returns if a socket has been shut down.
• socket-host-address - returns the host address of a socket.
• socket-host-name - returns the hostname of a socket.
• socket-input - returns the input port to read from a socket.
• socket-local-address - returns the local address of a socket.
• socket-output - returns the output port to write to a socket.
• socket-port-number - returns the port number of a socket.
• socket-shutdown - shuts down a socket.
• socket? - recognizes sockets.
• *net-timeout* - contains the timeout for socket operations.

#### HanDBase

• hb-add-record - adds a new record to a HanDBase record
• hb-dir - retrieves a list of all
• hb-info - retrieves information of a particular
• hb-getfield - reads the value of a field in a specific record
• hb-getlinks - gets all records linked to by a specific record
• hb-setfield - updates a value of a field in a specific record
• hb-version - retrieves the version number of

#### VFS

• vfs-close - closes an open file.
• vfs-createdir - creates a new directory.
• vfs-delete - deletes a file or directory.
• vfs-dir - reads the directory of a VFS volume.
• vfs-eof? - gets the endoffile status of an open file.
• vfs-get-attr - reads the attributes of an open file.
• vfs-get-ts - reads the timestamps of an open file.
• vfs-open - opens a (raw) file or directory.
• vfs-open-input - opens a file for input.
• vfs-open-output - opens a file for output.
• vfs-read - reads from an open file.
• vfs-ref? - recognizes file references.
• vfs-rename - renames a file or directory.
• vfs-seek - repositions the file pointer.
• vfs-set-attr - sets the attributes of an open file.
• vfs-set-ts - sets the timestamps of an open file.
• vfs-size - gets the size of an open file.
• vfs-supported? - indicates, if VFS is supported.
• vfs-tell - tells the position in an open file.
• vfs-vol-get-label - returns the label of a VFS volume.
• vfs-vol-info - retrieves general information of a VFS volume.
• vfs-vol-set-label - sets the label of a VFS volume.
• vfs-vol-size - returns the size of a VFS volume.
• vfs-volumes - returns a list of all VFS volumes.
• vfs-write - writes data to an open file.

#### LispMe IO Extensions

• get-output-string - retrieves the contents of a string output port.
• input - parses data entered in a dialog box as a LispMe object.
• input-string - reads a string entered in a dialog box.
• open-input-list - opens a string list for input.
• open-input-string - opens a string for input.
• open-output-string - creates a string output port.
• *out-field* - is the output port for the output field.

category-scheme? category-handheld?