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 C

c...r

Any of the c...r procedures applies a sequence of car and cdr.

Category Primitive procedures
Format (c...r pair)
Parameters
paira pair
Description c...r applies a sequence of car and cdr procedures to pair and returns the result. The ... may be any combination of upto 12 (!) a or d, where an a corresponds to car and a d corresponds to cdr. (cx...r pair) is equivalent to (cxr (c...r pair)), where each x is either a or d.
R4RS Compliance Supports upto 12 nested applications instead of 4
Examples
(caar '((a b) c)) => a
(caddddddr '(a b c d e f g)) => g
(cddar '((a b c) (d e f)) => (c)

call/cc

call/cc calls a procedure with the current continuation as argument.

Category Primitive procedure
Format (call/cc procedure)
Parameters
procedurea procedure of one argument
Description call/cc calls procedure with the current continuation as its argument. The current continuation is a special procedure (recognized by continuation?) of one argument and represents the remainder of the computation from the call/cc-application. The continuation may be called at any time later with any argument, which will be the result of the call/cc-application. This may happen several times, as the continuation has unlimited extent like any other LispMe object, even when call/cc has returned once.

If the continuation is not called, the value returned by procedure is the value of this call/cc-application.

R4RS Compliance The verbose name call-with-current-continuation is not supported, you probably don't want to write this with Graffiti!
Examples
(call/cc (lambda (k) (* 3 (k 5)))) => 5
(((call/cc (lambda (x) x))
           (lambda (y) y)) 'foo)
=> foo (how does this work ? :-))

car

car returns the car component of a pair.

Category Primitive procedure
Format (car pair)
Parameters
paira pair
Description car returns the car component of pair. The car component is the first argument given in the cons procedure.

For related information, see cdr and cons.

R4RS Compliance Full
Examples
(car '(a b c)) => a
(car '((a b c))) => (a b c)
(car '(a . b)) => a
(car '()) => error

case

case tests a value against some constant lists and evaluates expressions associated with the first match.

Category Special form
Format (case expr (guard expr1 expr2 ...) ...)
Parameters
expr the expression to be tested.
guard ... may be either a list of values, or the keyword else.
expri ... expressions, which are evaluated sequentially, if the corresponding guard matches.
Description case first evaluates expr and tests sequentially, if its value is (using eqv?) in one of the constant lists guard. When the first match is encountered, its corresponding expri are evaluated from left to right and the value of the last expri is returned.

Note that the constant lists must not be quoted! The special keyword else can be used for an "otherwise" clause. It's an error, if no guard matches.

R4RS Compliance Full
Examples
(case 5 ((1 3 4 8) 'foo)
        ((2 5 6)   'bar)
        (else      'baz))
=> bar
(case 9 ((1 3 4 8) 'foo)
        ((2 5 6)   'bar))
=> error

cat-get-name

cat-get-name gets the name of a category for an open database.

Category Native procedure
Format (cat-get-name dbref category)
Parameters
dbrefan open database
categorya small integer
Description cat-get-name retrieves the name of category from the open database dbref as a string. Category names are stored within the AppInfoBlock of a PalmOS database. They cannot be modified by LispMe, only read. The category is an integer from 0 to 15. On error, #f is returned.
R4RS Compliance LispMe extension.
Examples
(cat-get-name (dm-open-db "Foo" 3) 3) => "My Notes"

cdr

cdr returns the cdr component of a pair.

Category Primitive procedure
Format (cdr pair)
Parameters
paira pair
Description cdr returns the cdr component of pair. The cdr component is the second argument given in the cons procedure.

For related information, see car and cons.

R4RS Compliance Full
Examples
(cdr '(a b c)) => (b c)
(cdr '((a b c))) => ()
(cdr '(a . b)) => b
(cdr '()) => error

ceiling

ceiling computes the smallest whole number greater than or equal to a number.

Category Primitive procedure (MathLib required)
Format (ceiling num)
Parameters
numa number
Description ceiling converts num to a floating point number and returns the smallest whole number greater than or equal to num. The result is not a LispMe integer, it's a floating point value

See also floor, round, and truncate.

R4RS Compliance Full
Examples
(ceiling -4.3) => -4
(ceiling 3.5) => 4

char->integer

char->integer converts a character to its ASCII code.

Category Primitive procedure
Format (char->integer char)
Parameters
chara character
Description char->integer returns the ASCII code of char. You should use a tool like AsciiChart to see characters and their codes on your Pilot.
R4RS Compliance Full
Examples
(char->integer #\F) => 70
(char->integer #\ü) => 252

char?

char? recognizes characters.

Category Primitive procedure
Format (char? obj)
Parameters
objany object
Description char? returns #t for a character and #f for any other object.
R4RS Compliance Full
Examples
(char? #\x) => #t
(char? "x") => #f
(char? 'x) => #f

circular?

circular? recognizes circular lists.

Category Native procedure
Format (circular? obj)
Parameters
objany object
Description circular? returns #t if obj is a list containing (at least) one cycle and #f for any other object.
R4RS Compliance LispMe extension
Examples
(circular '(a b c)) => #f
(let ((l '(a b))) (set-cdr! l l) (circular? l)) => #t

close-input-port

close-input-port closes an open input port.

Category Native procedure
Format (close-input-port inport)
Parameters
inportan input port
Description close-input-port closes an open input port and makes subsequent read attempts on this port fail. The return value is inport.
R4RS Compliance Full
Examples
(close-input-port (open-input-string "foo")) => [inport 5 @0 "foo"]

close-netlib

close-netlib closes the net library.

Category Native procedure
Format (close-netlib immediately)
Parameters
immediatelya boolean
Description close-netlib closes the net library and thus terminates a dial-up connection to the Internet. If immediately is true, the connection is terminated immediately, otherwise it is put in a close-wait state which actually terminates the connection after an interval configurable in the Palm preferences connection dialog, unless an application has requested network services in the meantime. If no connection is established, this function has no effect. The return value is immediately.
R4RS Compliance LispMe extension
Examples
(close-netlib #t) => #t and terminates dial-up connection immediately

close-output-port

close-output-port closes an open output port.

Category Native procedure
Format (close-output-port outport)
Parameters
outportan output port
Description close-output-port closes an open output port and makes subsequent write attempts on this port fail. The return value is outport.
R4RS Compliance Full
Examples
(close-output-port (open-output-string)) => [outport 5 ""]

close-serial

close-serial closes an open serial port.

Category Native procedure
Format (close-serial serial)
Parameters
serialan open serial port
Description close-serial closes an open serial port and releases its hardware resources. You should always close serial ports when no more needed to keep power consumption low. The return value is serial.
R4RS Compliance LispMe extension
Examples
(close-serial (open-serial #x8000 300 "8n1n")) => [closed serial]

complex?

complex? recognizes complex numbers.

Category Primitive procedure
Format (complex? obj)
Parameters
objany object
Description complex? returns #t for integer, real and complex numbers and #f for any other object. In fact, it's the same procedure as number?
R4RS Compliance Full
Examples
(complex? 42) => #t
(complex? -1.234e-55) => #t
(complex? 3.5-17i) => #t
(complex? 'foo) => #f

cond

cond sequentially tests conditions and evaluates expressions associated with the first true one.

Category Special form
Format (cond (guard expr1 expr2 ...) ...)
Parameters
guard ... any expression including the keyword else.
expri ... expressions, which are evaluated sequentially, if the corresponding guard is true.
Description cond evaluates each guard in sequence. When the first true guard is encountered, its corresponding expri are evaluated from left to right and the value of the last expri is returned.

The special keyword else, which is always true, can be used for an "otherwise" clause. It's an error, if no guard is true.

R4RS Compliance Expression sequence in each clause must not be empty
Examples
(cond ((< 6 1) 'a)
      ((> 6 1) 'b))
=> b
(cond ((< 6 6) 'a)
      ((> 6 6) 'b)
      (else    'c))
=> c
(cond (#f 0)) => error

conjugate

conjugate computes the conjugate of a complex number.

Category Native procedure
Format (conjugate z)
Parameters
zany number
Description conjugate computes the conjugate of the number z. The conjugate of the complex number x + iy is x - iy.
R4RS Compliance Full
Examples
(conjugate 5) => 5
(conjugate 3.7-4.1i) => 3.7+4.1i

cons

cons creates a freshly allocated pair.

Category Primitive procedure
Format (cons obj1 obj2)
Parameters
obj1any object
obj2any object
Description cons returns a freshly allocated pair whose car component is obj1 and whose cdr component is obj2. The new pair is always unique, i.e. it is not eq? to any other object. The procedures car and cdr are used to access the components of the pair.
R4RS Compliance Full
Examples
(cons 'a 'b) => (a . b)
(cons 1 '()) => (1)
(cons '(a) '(b)) => ((a) b)

continuation?

continuation? recognizes continuations.

Category Primitive procedure
Format (continuation? obj)
Parameters
objany object
Description continuation? returns #t for a continuation created with call/cc and #f for any other object.
R4RS Compliance Full
Examples
(continuation? (lambda (x) x)) => #f
(call/cc continuation?) => #t
(continuation? 'foo) => #f

cos

cos computes the cosine of a number.

Category Primitive procedure (MathLib required)
Format (cos z)
Parameters
zany number
Description cos computes the cosine of the number z. z is an angle measured in radians.

For complex arguments z = x + yi, the formula

cos z = cosx coshy - i sinx sinhy
is used.
R4RS Compliance Full
Examples
(cos 0) => 1
(cos 1) => 0.54030230586814
(cos 0.5+2i) => 3.30163733291409-1.73880950447431i

cosh

cosh computes the hyperbolic cosine of a number.

Category Primitive procedure (MathLib required)
Format (cosh z)
Parameters
zany number
Description cosh computes the hyperbolic cosine of the number z.

For complex arguments z = x + yi, the formula

cosh z = coshx cosy + i sinhx siny
is used.
R4RS Compliance LispMe extension
Examples
(cosh 0) => 1
(cosh 1) => 1.54308063481524
(cosh 0.5+2i) => -0.469257978229053+0.473830620416407i

crash

crash causes a fatal exception.

Category Native procedure
Format (crash)
Parameters none
Description crash generates a fatal exception by reading an integer from an odd address (68000 address error) and thus requires a soft reset. This function is for testing only to reproduce crashing a session. Crashed sessions can't be continued after the soft reset and must be deleted.
R4RS Compliance LispMe extension
Examples
(crash) => no result since crash

ctl-enter

ctl-enter is posted when a control is tapped.

Category UI event
Format (ctl-enter id)
Parameters
idthe form id of the tapped control
Description ctl-enter is the event posted when the user has tapped a control but not yet lifted the pen.

ctl-get-label

ctl-get-label returns the label of a UI control.

Category Native procedure
Format (ctl-get-label id)
Parameters
idthe form id of the control
Description ctl-get-label returns the label text of the control with id id as a string. This function makes only sense for pushbuttons or checkboxes.
R4RS Compliance LispMe extension
Examples
(ctl-get-label 9007) => "Break" (Break button in main form)

ctl-get-val

ctl-get-val returns the value of a UI control.

Category Native procedure
Format (ctl-get-val id)
Parameters
idthe form id of the control
Description ctl-get-val returns the value of a control with id id as a boolean. This function makes only sense for pushbuttons or checkboxes.
R4RS Compliance LispMe extension
Examples
(ctl-get-val 1300) => #t assuming the checkbox is checked

ctl-hit

ctl-hit simulates tapping a UI control.

Category Native procedure
Format (ctl-hit id)
Parameters
idthe form id of the control
Description ctl-hit simulates hitting the control with id id. This function makes only sense for pushbuttons or checkboxes. The return value is #n
R4RS Compliance LispMe extension
Examples
(ctl-hit 1300) => #n and toggles the checkbox

ctl-repeat

ctl-repeat is posted when a repeating button "fires".

Category UI event
Format (ctl-repeat id)
Parameters
idthe form id of the control
Description ctl-repeat is posted each time a repeating button control triggers while the user is holding the pen down. You should return #f from your event handler to make this work correctly.

ctl-select

ctl-select is posted when a control is selected.

Category UI event
Format (ctl-select id state)
Parameters
idthe form id of the selected control
state#t if control is on, #f otherwise
Description ctl-selected is the event posted when the user has tapped a control and released it.

ctl-set-label

ctl-set-label sets the label of a UI control.

Category Native procedure
Format (ctl-set-label id obj)
Parameters
idthe form id of the control
objany LispMe object
Description ctl-set-label sets the label text for the control with id id to obj. LispMe cares for the memory management and you don't have to reserve enough space in the resource. The return value is obj This function makes only sense for pushbuttons or checkboxes..
R4RS Compliance LispMe extension
Examples
(ctl-set-label 1300 "press me") => "press me" and sets the control text

ctl-set-val

ctl-set-val sets the value of a UI control.

Category Native procedure
Format (ctl-set-val id obj)
Parameters
idthe form id of the control
objany LispMe object
Description ctl-set-val sets the value of a control with id id to obj where #f means off and any other value on. This function makes only sense for pushbuttons or checkboxes. The return value is obj.
R4RS Compliance LispMe extension
Examples
(ctl-set-val 1300 68) => 68 and checks the checkbox

current-ticks

current-ticks returns the current ticks value.

Category Native procedure
Format (current-ticks)
Parameters None
Description current-ticks returns the number of ticks elapsed since the last soft reset as an integer. Ticks are printed with a trailing heart symbol.
R4RS Compliance LispMe extension
Examples
(current-ticks) => 2121197(Heart)

current-ts

current-ts returns the current timestamp.

Category Native procedure
Format (current-ts)
Parameters None
Description current-ts returns the current timestamp from the Palm's system clock, accurate to the second.
R4RS Compliance LispMe extension
Examples
(current-ts) => [ts 2001-07-08-02-10-57]

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