(wait ['cnt] . prg) -> any
- Waits for a condition. While the result of the execution of
prg
is NIL, a select system call is executed for all file
descriptors and timers in the VAL of the global variable *Run. When cnt is
non-NIL, the waiting time is limited to cnt
milliseconds. Returns the result of prg. See also key and sync.
: (wait 2000) # Wait 2 seconds
-> NIL
: (prog
(zero *Cnt)
(setq *Run # Install background loop
'((-2000 0 (println (inc '*Cnt)))) ) # Increment '*Cnt' every 2 sec
(wait NIL (> *Cnt 6)) # Wait until > 6
(off *Run) )
1 # Waiting ..
2
3
4
5
6
7
-> NIL
(week 'dat) -> num
- Returns the number of the week for a given
date dat. See also day, ultimo, datStr and strDat.
: (datStr (date))
-> "2007-06-01"
: (week (date))
-> 22
(when 'any . prg) -> any
- Conditional execution: When the condition
any evaluates to
non-NIL, prg is executed and the result is returned.
Otherwise NIL is returned. See also unless.
: (when (> 4 3) (println 'OK) (println 'Good))
OK
Good
-> Good
(while 'any . prg) -> any
- Conditional loop: While the condition
any evaluates to
non-NIL, prg is repeatedly executed. If
prg is never executed, NIL is returned. Otherwise the
result of prg is returned. See also until.
: (while (read)
(println 'got: @) )
abc
got: abc
1234
got: 1234
NIL
-> 1234
(what 'sym) -> lst
- Returns a list of all internal symbols that match the pattern string
sym. See also match,
who and can.
: (what "cd@dr")
-> (cdaddr cdaadr cddr cddddr cdddr cddadr cdadr)
(who 'any) -> lst
- Returns a list of all functions or method definitions that contain the atom
or pattern
any. See also match, what and can.
: (who 'caddr) # Who is using 'caddr'?
-> ($dat lint1 expDat datStr $tim tim$ mail _gen dat$ datSym)
: (who "Type error")
-> ((mis> . +Link) *Uni (mis> . +Joint))
: (more (who "Type error") pp) # Pretty print all results
(dm (mis> . +Link) (Val Obj)
(and
Val
(nor (isa (: type) Val) (canQuery Val))
"Type error" ) )
. # Stop
-> T
(wipe 'sym|lst) -> sym|lst
- Clears the
VAL and the property list of sym, or of
all symbols in the list lst. When a symbol is an external symbol,
its state is also set to "not loaded". Does nothing when sym is an
external symbol that has been modified or deleted ("dirty").
: (setq A (1 2 3 4))
-> (1 2 3 4)
: (put 'A 'a 1)
-> 1
: (put 'A 'b 2)
-> 2
: (show 'A)
A (1 2 3 4)
b 2
a 1
-> A
: (wipe 'A)
-> A
: (show 'A)
A NIL
-> A
(with 'sym . prg) -> any
- Saves the current object
This and sets it to the new value
sym. Then prg is executed, and This is
restored to its previous value. The return value is the result of
prg. Used typically to access the local data of sym in
the same manner as inside a method body. prg is not executed (and
NIL is returned) when sym is NIL.
(with 'X . prg) is equivalent to (let? This 'X . prg).
: (put 'X 'a 1)
-> 1
: (put 'X 'b 2)
-> 2
: (with 'X (list (: a) (: b)))
-> (1 2)
(wr 'cnt ..) -> cnt
- Writes all
cnt arguments as raw bytes to the current output
channel. See also rd and pr.
: (out "x" (wr 1 255 257)) # Write to "x"
-> 257
: (hd "x")
00000000 01 FF 01 ...
-> NIL
(wrap 'cnt 'lst) -> sym
- Returns a transient symbol with all characters in
lst packed in lines with a maximal length of
cnt. See also tab,
align and center.
: (wrap 20 (chop "The quick brown fox jumps over the lazy dog"))
-> "The quick brown fox^Jjumps over the lazy^Jdog"
: (wrap 8 (chop "The quick brown fox jumps over the lazy dog"))
-> "The^Jquick^Jbrown^Jfox^Jjumps^Jover the^Jlazy dog"