*Once
- Holds an
idx
tree of already
load
ed source locations (as returned
by file
) See also once
.
: *Once
-> (("lib/" "misc.l" . 11) (("lib/" "http.l" . 9) (("lib/" "form.l" . 11))))
*OS
- A global constant holding the name of the operating system. Possible values
include
"Linux"
, "FreeBSD"
, "Darwin"
or
"Cygwin"
.
: *OS
-> "Linux"
(obj (typ var [hook] val ..) var2 val2 ..) -> obj
- Finds or creates a database object (using
request
) corresponding to (typ var
[hook] val ..)
, and initializes additional properties using the
varN
and valN
arguments.
: (obj ((+Item) nr 2) nm "Spare Part" sup `(db 'nr '+CuSu 2) inv 100 pr 1250)
-> {3-2}
(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
(once . prg) -> any
- Executes
prg
once, when the current file is load
ed the first time. Subsequent loads at a
later time will not execute prg
, and once
returns
NIL
. See also *Once
.
(once
(zero *Cnt1 *Cnt2) # Init counters
(load "file1.l" "file2.l") ) # Load other files
(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
(opid) -> pid | NIL
- Returns the corresponding process ID when the current output channel is
writing to a pipe, otherwise
NIL
. See also ipid
and out
.
: (out '(cat) (call 'ps "-p" (opid)))
PID TTY TIME CMD
7127 pts/3 00:00:00 cat
-> T
(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 positve number, it is used
as the descriptor of an open file. If it is a negative number, the saved output
channel such many levels above the current one is used. Otherwise (if it is a
list), it is taken as a command with arguments, and a pipe is opened for output.
See also opid
, call
, in
, pipe
, ctl
, close
and load
.
: (out "a" (println 123 '(a b c) 'def)) # Write one line to file "a"
-> def