1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/1998/REC-html40-19980424/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>O</title>
<link rel="stylesheet" href="doc.css" type="text/css">
</head>
<body>
<h1>O</h1>
<dl>
<dt><a name="*Once"><code>*Once</code></a>
<dd>Holds an <code><a href="refI.html#idx">idx</a></code> tree of already
<code><a href="refL.html#load">load</a></code>ed source locations (as returned
by <code><a href="refF.html#file">file</a></code>) See also <code><a
href="refO.html#once">once</a></code>.
<pre><code>
: *Once
-> (("lib/" "misc.l" . 11) (("lib/" "http.l" . 9) (("lib/" "form.l" . 11))))
</code></pre>
<dt><a name="*OS"><code>*OS</code></a>
<dd>A global constant holding the name of the operating system. Possible values
include <code>"Linux"</code>, <code>"FreeBSD"</code>, <code>"Darwin"</code> or
<code>"Cygwin"</code>.
<pre><code>
: *OS
-> "Linux"
</code></pre>
<dt><a name="obj"><code>(obj (typ var [hook] val ..) var2 val2 ..) -> obj</code></a>
<dd>Finds or creates a database object (using <code><a
href="refR.html#request">request</a></code>) corresponding to <code>(typ var
[hook] val ..)</code>, and initializes additional properties using the
<code>varN</code> and <code>valN</code> arguments.
<pre><code>
: (obj ((+Item) nr 2) nm "Spare Part" sup `(db 'nr '+CuSu 2) inv 100 pr 1250)
-> {3-2}
</code></pre>
<dt><a name="object"><code>(object 'sym 'any ['sym2 'any2 ..]) -> obj</code></a>
<dd>Defines <code>sym</code> to be an object with the value (or type)
<code>any</code>. The property list is initialized with all optionally supplied
key-value pairs. See also <code><a href="ref.html#oop">OO Concepts</a></code>,
<code><a href="refN.html#new">new</a></code>, <code><a
href="refT.html#type">type</a></code> and <code><a
href="refI.html#isa">isa</a></code>.
<pre><code>
: (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
</code></pre>
<dt><a name="oct"><code>(oct 'num ['num]) -> sym</code></a>
<dt><code>(oct 'sym) -> num</code>
<dd>Converts a number <code>num</code> to an octal string, or an octal string
<code>sym</code> to a number. In the first case, if the second argument is
given, the result is separated by spaces into groups of such many digits. See
also <code><a href="refB.html#bin">bin</a></code>, <code><a
href="refH.html#hex">hex</a></code>, <code><a
href="refF.html#fmt64">fmt64</a></code>, <code><a
href="refH.html#hax">hax</a></code> and <code><a
href="refF.html#format">format</a></code>.
<pre><code>
: (oct 73)
-> "111"
: (oct "111")
-> 73
: (oct 1234567 3)
-> "4 553 207"
</code></pre>
<dt><a name="off"><code>(off var ..) -> NIL</code></a>
<dd>Stores <code>NIL</code> in all <code>var</code> arguments. See also <code><a
href="refO.html#on">on</a></code>, <code><a
href="refO.html#onOff">onOff</a></code>, <code><a
href="refZ.html#zero">zero</a></code> and <code><a
href="refO.html#one">one</a></code>.
<pre><code>
: (off A B)
-> NIL
: A
-> NIL
: B
-> NIL
</code></pre>
<dt><a name="offset"><code>(offset 'lst1 'lst2) -> cnt | NIL</code></a>
<dd>Returns the <code>cnt</code> position of the tail list <code>lst1</code> in
<code>lst2</code>, or <code>NIL</code> if it is not found. See also <code><a
href="refI.html#index">index</a></code> and <code><a
href="refT.html#tail">tail</a></code>.
<pre><code>
: (offset '(c d e f) '(a b c d e f))
-> 3
: (offset '(c d e) '(a b c d e f))
-> NIL
</code></pre>
<dt><a name="on"><code>(on var ..) -> T</code></a>
<dd>Stores <code>T</code> in all <code>var</code> arguments. See also <code><a
href="refO.html#off">off</a></code>, <code><a
href="refO.html#onOff">onOff</a></code>, <code><a
href="refZ.html#zero">zero</a></code> and <code><a
href="refO.html#one">one</a></code>.
<pre><code>
: (on A B)
-> T
: A
-> T
: B
-> T
</code></pre>
<dt><a name="once"><code>(once . prg) -> any</code></a>
<dd>Executes <code>prg</code> once, when the current file is <code><a
href="refL.html#load">load</a></code>ed the first time. Subsequent loads at a
later time will not execute <code>prg</code>, and <code>once</code> returns
<code>NIL</code>. See also <code><a href="refO.html#*Once">*Once</a></code>.
<pre><code>
(once
(zero *Cnt1 *Cnt2) # Init counters
(load "file1.l" "file2.l") ) # Load other files
</code></pre>
<dt><a name="one"><code>(one var ..) -> 1</code></a>
<dd>Stores <code>1</code> in all <code>var</code> arguments. See also <code><a
href="refZ.html#zero">zero</a></code>, <code><a
href="refO.html#on">on</a></code>, <code><a href="refO.html#off">off</a></code>
and <code><a href="refO.html#onOff">onOff</a></code>.
<pre><code>
: (one A B)
-> 1
: A
-> 1
: B
-> 1
</code></pre>
<dt><a name="onOff"><code>(onOff var ..) -> flg</code></a>
<dd>Logically negates the values of all <code>var</code> arguments. Returns the
new value of the last symbol. See also <code><a
href="refO.html#on">on</a></code>, <code><a href="refO.html#off">off</a></code>,
<code><a href="refZ.html#zero">zero</a></code> and <code><a
href="refO.html#one">one</a></code>.
<pre><code>
: (onOff A B)
-> T
: A
-> T
: B
-> T
: (onOff A B)
-> NIL
: A
-> NIL
: B
-> NIL
</code></pre>
<dt><a name="open"><code>(open 'any ['flg]) -> cnt | NIL</code></a>
<dd>Opens the file with the name <code>any</code> in read/write mode (or
read-only if <code>flg</code> is non-<code>NIL</code>), and returns a file
descriptor <code>cnt</code> (or <code>NIL</code> on error). A leading
"<code>@</code>" character in <code>any</code> is substituted with the
<u>PicoLisp Home Directory</u>, as it was remembered during interpreter startup.
If <code>flg</code> is <code>NIL</code> and the file does not exist, it is
created. The file descriptor can be used in subsequent calls to <code><a
href="refI.html#in">in</a></code> and <code><a
href="refO.html#out">out</a></code>. See also <code><a
href="refC.html#close">close</a></code> and <code><a
href="refP.html#poll">poll</a></code>.
<pre><code>
: (open "x")
-> 3
</code></pre>
<dt><a name="opid"><code>(opid) -> pid | NIL</code></a>
<dd>Returns the corresponding process ID when the current output channel is
writing to a pipe, otherwise <code>NIL</code>. See also <code><a
href="refI.html#ipid">ipid</a></code> and <code><a
href="refO.html#out">out</a></code>.
<pre><code>
: (out '(cat) (call 'ps "-p" (opid)))
PID TTY TIME CMD
7127 pts/3 00:00:00 cat
-> T
</code></pre>
<dt><a name="opt"><code>(opt) -> sym</code></a>
<dd>Return the next command line argument ("option", as would be processed by
<code><a href="refL.html#load">load</a></code>) as a string, and remove it from
the remaining command line arguments. See also <a
href="ref.html#invoc">Invocation</a> and <code><a
href="refA.html#argv">argv</a></code>.
<pre><code>
$ pil -"de f () (println 'opt (opt))" -f abc -bye
opt "abc"
</code></pre>
<dt><a name="or"><code>(or 'any ..) -> any</code></a>
<dd>Logical OR. The expressions <code>any</code> are evaluated from left to
right. If a non-<code>NIL</code> value is encountered, it is returned
immediately. Else the result of the last expression is returned.
<pre><code>
: (or (= 3 3) (read))
-> T
: (or (= 3 4) (read))
abc
-> abc
</code></pre>
<dt><a name="or/2"><code>or/2</code></a>
<dd><a href="ref.html#pilog">Pilog</a> predicate that takes an arbitrary number
of clauses, and succeeds if one of them can be proven. See also <code><a
href="refN.html#not/1">not/1</a></code>.
<pre><code>
: (?
(or
((equal 3 @X) (equal @X 4))
((equal 7 @X) (equal @X 7)) ) )
@X=7
-> NIL</code></pre>
<dt><a name="out"><code>(out 'any . prg) -> any</code></a>
<dd>Opens <code>any</code> as output channel during the execution of
<code>prg</code>. The current output channel will be saved and restored
appropriately. If the argument is <code>NIL</code>, 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 "<code>+</code>"). 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 <code><a href="refO.html#opid">opid</a></code>, <code> <a
href="refC.html#call">call</a></code>, <code><a
href="refI.html#in">in</a></code>, <code> <a
href="refE.html#err">err</a></code>, <code> <a
href="refC.html#ctl">ctl</a></code>, <code><a
href="refP.html#pipe">pipe</a></code>, <code> <a
href="refP.html#poll">poll</a></code>, <code> <a
href="refC.html#close">close</a></code> and <code><a
href="refL.html#load">load</a></code>.
<pre><code>
: (out "a" (println 123 '(a b c) 'def)) # Write one line to file "a"
-> def
</code></pre>
</dl>
</body>
</html>
|