G

(gc ['cnt [cnt2]]) -> cnt | NIL
Forces a garbage collection. When cnt is given, so many megabytes of free cells are reserved, increasing the heap size if necessary. If cnt is zero, all currently unused heap blocks are purged, decreasing the heap size if possible. If cnt2 (64-bit version only) is given, the reserve size (defaults to 1 megabyte) is set to that value. Before collection (but after argument evaluation) the global variables @ and @@ are set to NIL. See also heap.

: (gc)
-> NIL
: (heap)
-> 2
: (gc 4)
-> 4
: (heap)
-> 5
(ge0 'any) -> num | NIL
Returns num when the argument is a number and greater or equal zero, otherwise NIL. See also lt0, le0, gt0, =0 and n0.

: (ge0 -2)
-> NIL
: (ge0 3)
-> 3
: (ge0 0)
-> 0
(genKey 'var 'cls ['hook ['num1 ['num2]]]) -> num
Generates a key for a database tree. If a minimal key num1 and/or a maximal key num2 is given, the next free number in that range is returned. Otherwise, the current maximal key plus one is returned. See also useKey, genStrKey and maxKey.

: (maxKey (tree 'nr '+Item))
-> 8
: (genKey 'nr '+Item)
-> 9
(genStrKey 'sym 'var 'cls ['hook]) -> sym
Generates a unique string for a database tree, by prepending as many "# " sequences as necessary. See also genKey.

: (genStrKey "ben" 'nm '+User)
-> "# ben"
(get 'sym1|lst ['sym2|cnt ..]) -> any
Fetches a value any from the properties of a symbol, or from a list. From the first argument sym1|lst, values are retrieved in successive steps by either extracting the value (if the next argument is zero) or a property from a symbol, the asoqed element (if the next argument is a symbol), the n'th element (if the next argument is a positive number) or the n'th CDR (if the next argument is a negative number) from a list. See also put, ; and :.

: (put 'X 'a 1)
-> 1
: (get 'X 'a)
-> 1
: (put 'Y 'link 'X)
-> X
: (get 'Y 'link)
-> X
: (get 'Y 'link 'a)
-> 1
: (get '((a (b . 1) (c . 2)) (d (e . 3) (f . 4))) 'a 'b)
-> 1
: (get '((a (b . 1) (c . 2)) (d (e . 3) (f . 4))) 'd 'f)
-> 4
: (get '(X Y Z) 2)
-> Y
: (get '(X Y Z) 2 'link 'a)
-> 1
(getd 'any) -> fun | NIL
Returns fun if any is a symbol that has a function definition, otherwise NIL. See also fun?.

: (getd '+)
-> 67327232
: (getd 'script)
-> ((File . @) (load File))
: (getd 1)
-> NIL
(getl 'sym1|lst1 ['sym2|cnt ..]) -> lst
Fetches the complete property list lst from a symbol. That symbol is sym1 (if no other arguments are given), or a symbol found by applying the get algorithm to sym1|lst1 and the following arguments. See also putl and maps.

: (put 'X 'a 1)
-> 1
: (put 'X 'b 2)
-> 2
: (put 'X 'flg T)
-> T
: (getl 'X)
-> (flg (2 . b) (1 . a))
(glue 'any 'lst) -> sym
Builds a new transient symbol (string) by packing the any argument between the individual elements of lst. See also text.

: (glue "," '(a b c d))
-> "a,b,c,d"
(goal '([pat 'any ..] . lst) ['sym 'any ..]) -> lst
Constructs a Pilog query list from the list of clauses lst. The head of the argument list may consist of a sequence of pattern symbols (Pilog variables) and expressions, which are used together with the optional sym and any arguments to form an initial environment. See also prove and fail.

: (goal '((likes John @X)))
-> (((1 (0) NIL ((likes John @X)) NIL T)))
: (goal '(@X 'John (likes @X @Y)))
-> (((1 (0) NIL ((likes @X @Y)) NIL ((0 . @X) 1 . John) T)))
(group 'lst) -> lst
Builds a list of lists, by grouping all elements of lst with the same CAR into a common sublist. See also Comparing, by, sort and uniq.

: (group '((1 . a) (1 . b) (1 . c) (2 . d) (2 . e) (2 . f)))
-> ((1 a b c) (2 d e f))
: (by name group '("x" "x" "y" "z" "x" "z")))
-> (("x" "x" "x") ("y") ("z" "z"))
: (by length group '(123 (1 2) "abcd" "xyz" (1 2 3 4) "XY"))
-> ((123 "xyz") ((1 2) "XY") ("abcd" (1 2 3 4))
(gt0 'any) -> num | NIL
Returns num when the argument is a number and greater than zero, otherwise NIL. See also lt0, le0, ge0, =0 and n0.

: (gt0 -2)
-> NIL
: (gt0 3)
-> 3