*Uni
- A global variable holding an
idx
tree, with all unique data that were collected with the comma (,)
read-macro. Typically used for localization. See also Read-Macros and locale.
: (off *Uni) # Clear
-> NIL
: ,"abc" # Collect a transient symbol
-> "abc"
: ,(1 2 3) # Collect a list
-> (1 2 3)
: *Uni
-> ("abc" NIL (1 2 3))
(udp 'any1 'cnt 'any2) -> any
(udp 'cnt) -> any
- Simple unidirectional sending/receiving of UDP packets. In the first form,
any2 is sent to a UDP server listening at host any1,
port cnt. In the second form, one item is received from a UDP
socket cnt, established with port. See also connect.
# First session
: (port T 6666)
-> 3
: (udp 3) # Receive a datagram
# Second session (on the same machine)
: (udp "localhost" 6666 '(a b c))
-> (a b c)
# First session
-> (a b c)
(ultimo 'y 'm) -> cnt
- Returns the
date of the last day
of the month m in the year y. See also day and week.
: (date (ultimo 2007 1))
-> (2007 1 31)
: (date (ultimo 2007 2))
-> (2007 2 28)
: (date (ultimo 2004 2))
-> (2004 2 29)
: (date (ultimo 2000 2))
-> (2000 2 29)
: (date (ultimo 1900 2))
-> (1900 2 28)
(undef 'sym) -> fun
(undef 'sym 'cls) -> fun
(undef '(sym . cls)) -> fun
- Undefines the function or method
sym. Returns the previous
definition. See also de, dm, def
and redef.
: (de hello () "Hello world!")
-> hello
: hello
-> (NIL "Hello world!")
: (undef 'hello)
-> (NIL "Hello world!")
: hello
-> NIL
(unify 'any) -> lst
- Unifies
any with the current Pilog
environment at the current level and with a value of NIL, and
returns the new environment or NIL if not successful. See also
prove and ->.
: (? (@A unify '(@B @C)))
@A=(((NIL . @C) 0 . @C) ((NIL . @B) 0 . @B) T)
(uniq 'lst) -> lst
- Returns a unique list, by eleminating all duplicate elements from
lst. See also Comparing, sort and group.
: (uniq (2 4 6 1 2 3 4 5 6 1 3 5))
-> (2 4 6 1 3 5)
(unless 'any . prg) -> any
- Conditional execution: When the condition
any evaluates to
non-NIL, NIL is returned. Otherwise prg
is executed and the result returned. See also when.
: (unless (= 3 3) (println 'Strange 'result))
-> NIL
: (unless (= 3 4) (println 'Strange 'result))
Strange result
-> result
(until 'any . prg) -> any
- Conditional loop: While the condition
any evaluates to
NIL, prg is repeatedly executed. If prg
is never executed, NIL is returned. Otherwise the result of
prg is returned. See also while.
: (until (=T (setq N (read)))
(println 'square (* N N)) )
4
square 16
9
square 81
T
-> 81
(up [cnt] sym ['val]) -> any
- Looks up (or modifies) the
cnt'th previously saved value of
sym in the corresponding enclosing environment. If cnt
is not given, 1 is used. See also eval, run and env.
: (let N 1 ((quote (N) (println N (up N))) 2))
2 1
-> 1
: (let N 1 ((quote (N) (println N (up N) (up N 7))) 2) N)
2 1 7
-> 7
(upp? 'any) -> sym | NIL
- Returns
any when the argument is a string (symbol) that starts
with an uppercase character. See also uppc.
: (upp? "A")
-> T
: (upp? "a")
-> NIL
: (upp? 123)
-> NIL
: (upp? ".")
-> NIL
(uppc 'any) -> any
- Upper case conversion: If
any is not a symbol, it is returned
as it is. Otherwise, a new transient symbol with all characters of
any, converted to upper case, is returned. See also lowc, fold and upp?.
: (uppc 123)
-> 123
: (uppc "abc")
-> "ABC"
: (uppc 'car)
-> "CAR"
(use sym . prg) -> any
(use (sym ..) . prg) -> any
- Defines local variables. The value of the symbol
sym - or the
values of the symbols sym in the list of the second form - are
saved, prg is executed, then the symbols are restored to their
original values. During execution of prg, the values of the symbols
can be temporarily modified. The return value is the result of prg.
See also bind, job and let.
: (setq X 123 Y 456)
-> 456
: (use (X Y) (setq X 3 Y 4) (* X Y))
-> 12
: X
-> 123
: Y
-> 456
(useKey 'var 'cls ['hook]) -> num
- Generates or reuses a key for a database tree, by randomly trying to locate
a free number. See also
genKey.
: (maxKey (tree 'nr '+Item))
-> 8
: (useKey 'nr '+Item)
-> 12
(usec) -> num
- Returns the number the microseconds since interpreter startup. See also
time and tick.
: (usec)
-> 1154702479219050