picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

refG.html (6396B)


      1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/1998/REC-html40-19980424/loose.dtd">
      2 <html lang="en">
      3 <head>
      4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      5 <title>G</title>
      6 <link rel="stylesheet" href="doc.css" type="text/css">
      7 </head>
      8 <body>
      9 
     10 <h1>G</h1>
     11 
     12 <dl>
     13 
     14 <dt><a name="gc"><code>(gc ['cnt]) -> cnt | NIL</code></a>
     15 <dd>Forces a garbage collection. When <code>cnt</code> is given, so many
     16 megabytes of free cells are reserved, increasing the heap size if necessary. If
     17 <code>cnt</code> is zero, all currently unused heap blocks are purged,
     18 decreasing the heap size if possible. See also <code><a
     19 href="refH.html#heap">heap</a></code>.
     20 
     21 <pre><code>
     22 : (gc)
     23 -> NIL
     24 : (heap)
     25 -> 2
     26 : (gc 4)
     27 -> 4
     28 : (heap)
     29 -> 5
     30 </code></pre>
     31 
     32 <dt><a name="ge0"><code>(ge0 'any) -> num | NIL</code></a>
     33 <dd>Returns <code>num</code> when the argument is a number and greater or equal
     34 zero, otherwise <code>NIL</code>. See also <code><a
     35 href="refL.html#lt0">lt0</a></code>, <code><a
     36 href="refL.html#le0">le0</a></code>, <code><a
     37 href="refG.html#gt0">gt0</a></code>, <code><a href="ref_.html#=0">=0</a></code>
     38 and <code><a href="refN.html#n0">n0</a></code>.
     39 
     40 <pre><code>
     41 : (ge0 -2)
     42 -> NIL
     43 : (ge0 3)
     44 -> 3
     45 : (ge0 0)
     46 -> 0
     47 </code></pre>
     48 
     49 <dt><a name="genKey"><code>(genKey 'var 'cls ['hook ['num1 ['num2]]]) -> num</code></a>
     50 <dd>Generates a key for a database tree. If a minimal key <code>num1</code>
     51 and/or a maximal key <code>num2</code> is given, the next free number in that
     52 range is returned. Otherwise, the current maximal key plus one is returned. See
     53 also <code><a href="refU.html#useKey">useKey</a></code>, <code><a
     54 href="refG.html#genStrKey">genStrKey</a></code> and <code><a
     55 href="refM.html#maxKey">maxKey</a></code>.
     56 
     57 <pre><code>
     58 : (maxKey (tree 'nr '+Item))
     59 -> 8
     60 : (genKey 'nr '+Item)
     61 -> 9
     62 </code></pre>
     63 
     64 <dt><a name="genStrKey"><code>(genStrKey 'sym 'var 'cls ['hook]) -> sym</code></a>
     65 <dd>Generates a unique string for a database tree, by prepending as many "# "
     66 sequences as necessary. See also <code><a
     67 href="refG.html#genKey">genKey</a></code>.
     68 
     69 <pre><code>
     70 : (genStrKey "ben" 'nm '+User)
     71 -> "# ben"
     72 </code></pre>
     73 
     74 <dt><a name="get"><code>(get 'sym1|lst ['sym2|cnt ..]) -> any</code></a>
     75 <dd>Fetches a value <code>any</code> from the properties of a symbol, or from a
     76 list. From the first argument <code>sym1|lst</code>, values are retrieved in
     77 successive steps by either extracting the value (if the next argument is zero)
     78 or a property from a symbol, the <code><a
     79 href="refA.html#asoq">asoq</a></code>ed element (if the next argument is a
     80 symbol), the n'th element (if the next argument is a positive number) or the
     81 n'th CDR (if the next argument is a negative number) from a list. See also
     82 <code><a href="refP.html#put">put</a></code>, <code><a
     83 href="ref_.html#;">;</a></code> and <code><a href="ref_.html#:">:</a></code>.
     84 
     85 <pre><code>
     86 : (put 'X 'a 1)
     87 -> 1
     88 : (get 'X 'a)
     89 -> 1
     90 : (put 'Y 'link 'X)
     91 -> X
     92 : (get 'Y 'link)
     93 -> X
     94 : (get 'Y 'link 'a)
     95 -> 1
     96 : (get '((a (b . 1) (c . 2)) (d (e . 3) (f . 4))) 'a 'b)
     97 -> 1
     98 : (get '((a (b . 1) (c . 2)) (d (e . 3) (f . 4))) 'd 'f)
     99 -> 4
    100 : (get '(X Y Z) 2)
    101 -> Y
    102 : (get '(X Y Z) 2 'link 'a)
    103 -> 1
    104 </code></pre>
    105 
    106 <dt><a name="getd"><code>(getd 'any) -> fun | NIL</code></a>
    107 <dd>Returns <code>fun</code> if <code>any</code> is a symbol that has a function
    108 definition, otherwise <code>NIL</code>. See also <code><a
    109 href="refF.html#fun?">fun?</a></code>.
    110 
    111 <pre><code>
    112 : (getd '+)
    113 -> 67327232
    114 : (getd 'script)
    115 -> ((File . @) (load File))
    116 : (getd 1)
    117 -> NIL
    118 </code></pre>
    119 
    120 <dt><a name="getl"><code>(getl 'sym1|lst1 ['sym2|cnt ..]) -> lst</code></a>
    121 <dd>Fetches the complete property list <code>lst</code> from a symbol. That
    122 symbol is <code>sym1</code> (if no other arguments are given), or a symbol found
    123 by applying the <code><a href="refG.html#get">get</a></code> algorithm to
    124 <code>sym1|lst1</code> and the following arguments. See also <code><a
    125 href="refP.html#putl">putl</a></code> and <code><a
    126 href="refM.html#maps">maps</a></code>.
    127 
    128 <pre><code>
    129 : (put 'X 'a 1)
    130 -> 1
    131 : (put 'X 'b 2)
    132 -> 2
    133 : (put 'X 'flg T)
    134 -> T
    135 : (getl 'X)
    136 -> (flg (2 . b) (1 . a))
    137 </code></pre>
    138 
    139 <dt><a name="glue"><code>(glue 'any 'lst) -> sym</code></a>
    140 <dd>Builds a new transient symbol (string) by <code><a
    141 href="refP.html#pack">pack</a></code>ing the <code>any</code> argument between
    142 the individual elements of <code>lst</code>. See also <code><a
    143 href="refT.html#text">text</a></code>.
    144 
    145 <pre><code>
    146 : (glue "," '(a b c d))
    147 -> "a,b,c,d"
    148 </code></pre>
    149 
    150 <dt><a name="goal"><code>(goal '([pat 'any ..] . lst) ['sym 'any ..]) -> lst</code></a>
    151 <dd>Constructs a <a href="ref.html#pilog">Pilog</a> query list from the list of
    152 clauses <code>lst</code>. The head of the argument list may consist of a
    153 sequence of pattern symbols (Pilog variables) and expressions, which are used
    154 together with the optional <code>sym</code> and <code>any</code> arguments to
    155 form an initial environment. See also <code><a
    156 href="refP.html#prove">prove</a></code> and <code><a
    157 href="refF.html#fail">fail</a></code>.
    158 
    159 <pre><code>
    160 : (goal '((likes John @X)))
    161 -> (((1 (0) NIL ((likes John @X)) NIL T)))
    162 : (goal '(@X 'John (likes @X @Y)))
    163 -> (((1 (0) NIL ((likes @X @Y)) NIL ((0 . @X) 1 . John) T)))
    164 </code></pre>
    165 
    166 <dt><a name="group"><code>(group 'lst) -> lst</code></a>
    167 <dd>Builds a list of lists, by grouping all elements of <code>lst</code> with
    168 the same CAR into a common sublist. See also <a
    169 href="ref.html#cmp">Comparing</a>, <code><a
    170 href="refB.html#by">by</a></code>, <code><a
    171 href="refS.html#sort">sort</a></code> and <code><a
    172 href="refU.html#uniq">uniq</a></code>.
    173 
    174 <pre><code>
    175 : (group '((1 . a) (1 . b) (1 . c) (2 . d) (2 . e) (2 . f)))
    176 -> ((1 a b c) (2 d e f))
    177 : (by name group '("x" "x" "y" "z" "x" "z")))
    178 -> (("x" "x" "x") ("y") ("z" "z"))
    179 : (by length group '(123 (1 2) "abcd" "xyz" (1 2 3 4) "XY"))
    180 -> ((123 "xyz") ((1 2) "XY") ("abcd" (1 2 3 4))
    181 </code></pre>
    182 
    183 <dt><a name="gt0"><code>(gt0 'any) -> num | NIL</code></a>
    184 <dd>Returns <code>num</code> when the argument is a number and greater than
    185 zero, otherwise <code>NIL</code>. See also <code><a
    186 href="refL.html#lt0">lt0</a></code>, <code><a
    187 href="refL.html#le0">le0</a></code>, <code><a
    188 href="refG.html#ge0">ge0</a></code>, <code><a href="ref_.html#=0">=0</a></code>
    189 and <code><a href="refN.html#n0">n0</a></code>.
    190 
    191 <pre><code>
    192 : (gt0 -2)
    193 -> NIL
    194 : (gt0 3)
    195 -> 3
    196 </code></pre>
    197 
    198 </dl>
    199 
    200 </body>
    201 </html>