Back to index A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Other

Alphabetic catalog of Language elements M

macro

macro replaces an expression with another one at compile time.

Category Special form
Format
(macro (var arg) expr1 expr2 ...)
Parameters
var a variable name to be used as the keyword of a new special form
arg a symbol bound to the original expression
expri the expressions which are evaluated in the extended environment when the macro is expanded.
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:

  • a macro single expansion may take only a limited number of VM steps.
  • the number of macro expansions during a single compilation is limited, too
If you find these limits (indicated by this error) too restrictive, please email me at bugs@lispme.de.

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
(macro (my-or expr)
  (let ((name (gensym)))
    (cond ((null? (cdr expr)) #f)
          ((null? (cddr expr)) (cadr expr))
          (else `(let ((,name ,(cadr expr)))
                   (if ,name ,name
                     (my-or ,@(cddr expr))))))))
=> creates a special form my-or, which behaves exactly like or. Note the usage of gensym to create a new temporary name to avoid name clashes with other symbols and how to take advantage of the quasiquote syntax.

macro?

macro? recognizes macros.

Category Primitive procedure
Format (macro? obj)
Parameters
objany object
Description macro? returns #t for a macro created by the macro special form and #f for any other object.
R4RS Compliance Full
Examples
(macro? (lambda (x) x)) => #f
(macro? my-or) => #t, assuming the definition above is used

magnitude

magnitude computes the magnitude of a complex number.

Category Native procedure (MathLib required)
Format (magnitude z)
Parameters
zany number
Description magnitude computes the magnitude (or absolute value) of the number z.
R4RS Compliance Full
Examples
(magnitude 5) => 5
(magnitude -1) => 1
(magnitude 0.5+2i) => 2.06155281280883

make-client-socket

make-client-socket creates a client socket.

Category Native procedure
Format (make-client-socket host port)
Parameters
hosta string
portan integer
Description make-client-socket creates a stream socket and connects it to host host at port port. Host can be a symbolic name (like "www.lispme.de") which will be resolved by the DNS configured for the Palm's IP connection, or a numeric IP address written as a string like "127.0.0.1".

To retrieve the ports connected to this socket use socket-input and socket-output.

Currently only stream sockets are supported.

R4RS Compliance LispMe extension
Examples
(make-client-socket "localhost" 4711) => [socket 1] provided there is a server process running

make-date

make-date creates a date value.

Category Native procedure
Format (make-date y m d)
Parameters
yan integer 1904..2031
man integer 1..12
dan integer 1..31
Description make-date creates a date value from year, month, and date. Currently, the arguments are not checked, so don't be surprised by the results from PalmOS on illegal parameters...
R4RS Compliance LispMe extension
Examples
(make-date 1966 1 11) => [date 11. Jan 1966]

make-polar

make-polar constructs a complex number from a magnitude and angle.

Category Primitive procedure (MathLib required)
Format (make-polar mag ang)
Parameters
maga real number
anga real number
Description make-polar constructs a complex number from the magnitude mag and the angle ang.
R4RS Compliance Full
Examples
(make-polar 5 -2) => -2.08073418273571-4.546487134412841i
(eqv? (make-polar 7.2 1.8) 7.2@1.8) => #t

make-rectangular

make-rectangular constructs a complex number from the real and imaginary part.

Category Primitive procedure (MathLib required)
Format (make-rectangular re im)
Parameters
rea real number
ima real number
Description make-rectangular constructs a complex number from the real part re and the imaginary part re.
R4RS Compliance Full
Examples
(make-rectangular 5 -2) => 5-2i
(make-rectangular -1.1 0) => -1.1

make-strarr

make-strarr creates a PalmOS string array.

Category Native procedure
Format (make-strarr list)
Parameters
lista proper list
Description make-strarr prints all elements in list in human-readable format (see display) and creates a string array in internal PalmOS format.

The string array foreign datatype is normally used internally for holding the list items in a user interface List control, but it may be occasionally usefull for application programs, too.

R4RS Compliance LispMe extension
Examples
(make-strarr '(gold silver bronze)) => [strarr 3]

make-string

make-string creates a new string.

Category Native procedure
Format (make-string len char)
Parameters
lena positive integer
chara character
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
(make-string 5 #\x) => "xxxxx"

make-time

make-time creates a time value.

Category Native procedure
Format (make-time h m)
Parameters
han integer 0..23
man integer 0..59
Description make-time creates a time value from hour and minute. There are no seconds in a PalmOS time, sorry :-(
R4RS Compliance LispMe extension
Examples
(make-time 18 40) => [time 6.40 pm]

make-ts

make-ts creates a timestamp.

Category Native procedure
Format (make-ts num)
Parameters
numan integer
Description make-ts creates a timestamp value from the number of seconds since January 1st 1904, midnight (the base of PalmOS date calculations).
R4RS Compliance LispMe extension
Examples
(make-ts 3000000000) => [ts 1999-01-24-05-20-00]

make-vector

make-vector creates a new vector.

Category Native procedure
Format (make-vector len fill)
Parameters
lena positive integer
fillany object
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
(make-vector 3 'havanna) => #(havanna havanna havanna)

map

map applies a procedure to each element of a list.

Category Library procedure
Format (map proc list)
Parameters
proca procedure of one argument
lista proper list
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
(map (lambda (x) (* x x)) '(2 3 4 5)) => (4 9 16 25)

max

max returns the largest of some objects.

Category Library procedure
Format (max comp1 comp2 ...)
Parameters
compia comparable object
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
(max 50 30 10 80) => 80
(max "Baz" "Foo") => "Foo"

member memq memv

member, memq, and memv search lists for an element.

Category Native procedures
Formats
(member obj list)
(memq obj list)
(memv obj list)
Parameters
objany object
lista proper list
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
(member 'b '(a b c d)) => (b c d)
(member 'c '(a b)) => #f
(memq '(b) '(a (b) c)) => #f
(member '(b) '(a (b) c)) => ((b) c)

menu

menu is posted when a menu item has been selected.

Category UI event
Format (menu id)
Parameters
idthe id of the menu item
Description menu is the event posted when the user has selected a menu item or invoked a menu command by a command stroke shortcut.

message

message displays a message box.

Category Native procedure
Format (message obj)
Parameters
objany object
Description message prints obj using display to a message box (see User message). The return value is #n.
R4RS Compliance LispMe extension
Examples
(message "Hello, world") => #n, displays Hello, world in a message box

min

min returns the smallest of some objects.

Category Library procedure
Format (min comp1 comp2 ...)
Parameters
compia comparable object
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
(min 50 30 10 80) => 10
(min "Baz" "Foo") => "Baz"

modulo

modulo divides two integers and returns the remainder.

Category Library procedure
Format (modulo int1 int2)
Parameters
int1an integer
int2an integer
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
(modulo 13 4) => 1
(modulo -13 4) => 3
(modulo 13 -4) => -3
(modulo -13 -4) => -1
(modulo 13 0) => error

move

move moves the graphics cursor.

Category Native procedure
Format (move x y)
Parameters
xan integer
yan integer
Description move updates the current point stored in *gstate* 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
(move 100 80) => #n updating *gstate*.

Back to index A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Other