(object 'sym 'typ ['sym 'any ..]) -> obj
- Defines
sym to be an object of type typ. The
property list is initialized with all optionally supplied key-value pairs. See
also OO Concepts, new, type and isa.
: (object 'Obj '(+A +B +C) 'a 1 'b 2 'c 3)
-> Obj
: (show 'Obj)
Obj (+A +B +C)
c 3
b 2
a 1
-> Obj
(oct 'num) -> sym
(oct 'sym) -> num
- Converts a number
num to an octal string, or an octal string
sym to a number. See also hex and format.
: (oct 73)
-> "111"
: (oct "111")
-> 73
(off sym ..) -> NIL
- Stores
NIL in the VAL's of all argument symbols
sym. See also on, onOff, zero and one.
: (off A B)
-> NIL
: A
-> NIL
: B
-> NIL
(offset 'lst1 'lst2) -> cnt | NIL
- Returns the
cnt position of the tail list lst1 in
lst2, or NIL if it is not found. See also index.
: (offset '(c d e f) '(a b c d e f))
-> 3
: (offset '(c d e) '(a b c d e f))
-> NIL
(on sym ..) -> T
- Stores
T in the VAL's of all argument symbols
sym. See also off,
onOff, zero and one.
: (on A B)
-> T
: A
-> T
: B
-> T
(one sym ..) -> 1
- Stores
1 in the VAL's of all argument symbols
sym. See also zero,
on, off and onOff.
: (one A B)
-> 1
: A
-> 1
: B
-> 1
(onOff sym ..) -> flg
- Logical negates the
VAL's of all argument symbols
sym. Returns the new value of the last symbol. See also on, off,
zero and one.
: (onOff A B)
-> T
: A
-> T
: B
-> T
: (onOff A B)
-> NIL
: A
-> NIL
: B
-> NIL
(open 'sym) -> cnt | NIL
- Opens the file
sym in read/write mode, and returns a file
descriptor cnt (or NIL on error). If the file does not
exist, it is created. The file descriptor can be used in subsequent calls to
in and out. See also close.
: (open "x")
-> 3
(opt) -> sym
- Return the next command line argument (option) as a string, and remove it
from the remaining command line arguments. See also
Invocation and argv.
$ ./p -"de f () (println 'opt (opt))" -f abc -bye
opt "abc"
(or 'any ..) -> any
- Logical OR. The expressions
any are evaluated from left to
right. If a non-NIL value is encountered, it is returned
immediately. Else the result of the last expression is returned.
: (or (= 3 3) (read))
-> T
: (or (= 3 4) (read))
abc
-> abc
(out 'any . prg) -> any
- Opens
any as output channel during the execution of
prg. The current output channel will be saved and restored
appropriately. If the argument is NIL, standard output is used. If
the argument is a symbol, it is used as a file name (opened in "append" mode if
the first character is "+"). If it is a number, it is used as the
descriptor of an open file. Otherwise (if it is a list), it is taken as a
command with arguments, and a pipe is opened for output. See also call, in, pipe, ctl and load.
: (out "a" (println 123 '(a b c) 'def)) # Write one line to file "a"
-> def