ref_.html (17852B)
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>Other</title> 6 <link rel="stylesheet" href="doc.css" type="text/css"> 7 </head> 8 <body> 9 10 <h1>Other</h1> 11 12 <dl> 13 14 <dt><a name="!"><code>(! . exe) -> any</code></a> 15 <dd>Low level breakpoint function: The current execution environment is saved 16 and the I/O channels are redirected to the console. Then <code>exe</code> is 17 displayed, and a read-eval-print-loop is entered (with <code>!</code> as its 18 prompt character), to evaluate expressions and examine the current program 19 environment. An empty input line terminates the read-eval-print-loop, the 20 environment and I/O channels are restored, and the result of <code>exe</code> is 21 returned. <code>!</code> is normally inserted into existing programs with the 22 <code><a href="refD.html#debug">debug</a></code> function. See also <code><a 23 href="refE.html#e">e</a></code>, <code><a href="ref_.html#^">^</a></code> and 24 <code><a href="refD.html#*Dbg">*Dbg</a></code>. 25 26 <pre><code> 27 : (de foo (N) (and (println 1) (! println N) (println 2))) 28 -> foo 29 : (foo 7) 30 1 # Executed '(println 1)' 31 (println N) # Entered breakpoint 32 ! N # Examine the value of 'N' 33 -> 7 34 ! (e) # Evaluate '^', i.e. (println N) 35 7 36 -> 7 37 ! (e @) # Evaluate '@' -> the result of '(println 1)' 38 -> 1 39 ! # Empty line: continue 40 7 # Executed '(println N)' 41 2 # Executed '(println 2)' 42 -> 2 43 </code></pre> 44 45 <dt><a name="$"><code>($ sym|lst lst . prg) -> any</code></a> 46 <dd>Low level trace function: The first argument <code>sym|lst</code> is printed 47 to the console with a proper indentation, followed by a colon <code>:</code>. If 48 a function is traced, the first argument is the function symbol, else if a 49 method is traced, it is a cons pair of message and class. The second argument 50 <code>lst</code> should be a list of symbols, identical to the function's 51 argument list. The current values of these symbols are printed, followed by a 52 newline. Then <code>prg</code> is executed, and its return value printed in a 53 similar way (this time with an equals sign <code>=</code> instead of a colon) 54 and returned. <code>$</code> is normally inserted into existing programs with 55 the <code><a href="refT.html#trace">trace</a></code> function. 56 57 <pre><code> 58 : (de foo (A B) ($ foo (A B) (* A B))) 59 -> foo 60 : (foo 3 4) 61 foo : 3 4 # Function entry, arguments 3 and 4 62 foo = 12 # Function exit, return value 12 63 -> 12 64 </code></pre> 65 66 <dt><a name="$dat"><code>($dat 'sym1 ['sym2]) -> dat</code></a> 67 <dd>Converts a string <code>sym1</code> in ISO format to a <code><a 68 href="refD.html#date">date</a></code>, optionally using a delimiter character 69 <code>sym2</code>. See also <code><a href="refD.html#dat$">dat$</a></code>, 70 <code><a href="ref_.html#$tim">$tim</a></code>, <code><a 71 href="refS.html#strDat">strDat</a></code> and <code><a 72 href="refE.html#expDat">expDat</a></code>. 73 74 <pre><code> 75 : ($dat "20070601") 76 -> 733134 77 : ($dat "2007-06-01" "-") 78 -> 733134 79 </code></pre> 80 81 <dt><a name="$tim"><code>($tim 'sym) -> tim</code></a> 82 <dd>Converts a string to a <code><a href="refT.html#time">time</a></code>. The 83 minutes and seconds are optional and default to zero. See also <code><a 84 href="refT.html#tim$">tim$</a></code> and <code><a 85 href="ref_.html#$dat">$dat</a></code>. 86 87 <pre><code> 88 : (time ($tim "10:57:56")) 89 -> (10 57 56) 90 : (time ($tim "10:57")) 91 -> (10 57 0) 92 : (time ($tim "10")) 93 -> (10 0 0) 94 </code></pre> 95 96 <dt><a name="%"><code>(% 'num ..) -> num</code></a> 97 <dd>Returns the remainder from the divisions of successive <code>num</code> 98 arguments. The sign of the result is that of the first argument. When one of the 99 arguments evaluates to <code>NIL</code>, it is returned immediately. See also 100 <code><a href="ref_.html#/">/</a></code> and <code><a 101 href="ref_.html#*/">*/</a></code> . 102 103 <pre><code> 104 : (% 17 5) 105 -> 2 106 : (% -17 5) # Sign is that of the first argument 107 -> -2 108 : (% 5 2) 109 -> 1 110 : (% 15 10) 111 -> 5 112 : (% 15 10 2) # (% 15 10) -> 5, then (% 5 2) -> 1 113 -> 1 114 </code></pre> 115 116 <dt><a name="&"><code>(& 'num ..) -> num</code></a> 117 <dd>Returns the bitwise <code>AND</code> of all <code>num</code> arguments. When 118 one of the arguments evaluates to <code>NIL</code>, it is returned immediately. 119 See also <code><a href="ref_.html#|">|</a></code>, <code><a 120 href="refX.html#x|">x|</a></code> and <code><a 121 href="refB.html#bit?">bit?</a></code>. 122 123 <pre><code> 124 : (& 6 3) 125 -> 2 126 : (& 7 3 1) 127 -> 1 128 </code></pre> 129 130 <dt><a name="*"><code>(* 'num ..) -> num</code></a> 131 <dd>Returns the product of all <code>num</code> arguments. When one of the 132 arguments evaluates to <code>NIL</code>, it is returned immediately. See also 133 <code><a href="ref_.html#/">/</a></code>, <code><a 134 href="ref_.html#*/">*/</a></code>, <code><a href="ref_.html#+">+</a></code> and 135 <code><a href="ref_.html#-">-</a></code>. 136 137 <pre><code> 138 : (* 1 2 3) 139 -> 6 140 : (* 5 3 2 2) 141 -> 60 142 </code></pre> 143 144 <dt><a name="**"><code>(** 'num1 'num2) -> num</code></a> 145 <dd>Returns <code>num1</code> to the power of <code>num2</code>. 146 147 <pre><code> 148 : (** 2 3) 149 -> 8 150 : (** 100 100) 151 -> 10000000000000000000000000000000000000000000000000000000000000000000000000000 152 00000000000000000000000000000000000000000000000000000000000000000000000000000000 153 00000000000000000000000000000000000000000000 154 </code></pre> 155 156 <dt><a name="*/"><code>(*/ 'num1 ['num2 ..] 'num3) -> num</code></a> 157 <dd>Returns the product of <code>num1</code> and all following <code>num2</code> 158 arguments, divided by the <code>num3</code> argument. The result is rounded to 159 the nearest integer value. When one of the arguments evaluates to 160 <code>NIL</code>, it is returned immediately. Note that <code>*/</code> is 161 especially useful for fixed point arithmetic, by multiplying with (or dividing 162 by) the scale factor. See also <code><a href="ref_.html#*">*</a></code>, 163 <code><a href="ref_.html#/">/</a></code>, <code><a 164 href="ref_.html#+">+</a></code> and <code><a href="ref_.html#-">-</a></code>. 165 166 <pre><code> 167 : (*/ 3 4 2) 168 -> 6 169 : (*/ 1234 2 10) 170 -> 247 171 : (*/ 100 6) 172 -> 17 173 174 : (scl 2) 175 -> 2 176 : (format (*/ 3.0 1.5 1.0) *Scl) 177 -> "4.50" 178 </code></pre> 179 180 <dt><a name="+"><code>(+ 'num ..) -> num</code></a> 181 <dd>Returns the sum of all <code>num</code> arguments. When one of the arguments 182 evaluates to <code>NIL</code>, it is returned immediately. See also <code><a 183 href="refI.html#inc">inc</a></code>, <code><a href="ref_.html#-">-</a></code>, 184 <code><a href="ref_.html#*">*</a></code>, <code><a 185 href="ref_.html#/">/</a></code> and <code><a href="ref_.html#*/">*/</a></code>. 186 187 <pre><code> 188 : (+ 1 2 3) 189 -> 6 190 </code></pre> 191 192 <dt><a name="-"><code>(- 'num ..) -> num</code></a> 193 <dd>Returns the difference of the first <code>num</code> argument and all 194 following arguments. If only a single argument is given, it is negated. When one 195 of the arguments evaluates to <code>NIL</code>, it is returned immediately. See 196 also <code><a href="refD.html#dec">dec</a></code>, <code><a 197 href="ref_.html#+">+</a></code>, <code><a href="ref_.html#*">*</a></code>, 198 <code><a href="ref_.html#/">/</a></code> and <code><a 199 href="ref_.html#*/">*/</a></code>. 200 201 <pre><code> 202 : (- 7) 203 -> -7 204 : (- 7 2 1) 205 -> 4 206 </code></pre> 207 208 <dt><a name="->"><code>(-> any [num]) -> any</code></a> 209 <dd>Searches for the value of <code>any</code> (typically a <a 210 href="ref.html#pilog">Pilog</a> variable, or an expression of variables) at top 211 level (or level <code>num</code>) in the current environment. See also <code><a 212 href="refP.html#prove">prove</a></code> and <code><a 213 href="refU.html#unify">unify</a></code>. 214 215 <pre><code> 216 : (? (append (1 2 3) (4 5 6) @X) (^ @ (println 'X '= (-> @X)))) 217 X = (1 2 3 4 5 6) 218 @X=(1 2 3 4 5 6) 219 -> NIL 220 </code></pre> 221 222 <dt><a name="/"><code>(/ 'num ..) -> num</code></a> 223 <dd>Returns the first <code>num</code> argument successively divided by all 224 following arguments. When one of the arguments evaluates to <code>NIL</code>, it 225 is returned immediately. See also <code><a href="ref_.html#*">*</a></code>, 226 <code><a href="ref_.html#*/">*/</a></code>, <code><a 227 href="ref_.html#%">%</a></code>, <code><a href="ref_.html#+">+</a></code> and 228 <code><a href="ref_.html#-">-</a></code>. 229 230 <pre><code> 231 : (/ 12 3) 232 -> 4 233 : (/ 60 -3 2 2) 234 -> -5 235 </code></pre> 236 237 <dt><a name=":"><code>(: sym|0 [sym1|cnt ..]) -> any</code></a> 238 <dd>Fetches a value <code>any</code> from the properties of a symbol, or from a 239 list, by applying the <code><a href="refG.html#get">get</a></code> algorithm to 240 <code>This</code> and the following arguments. Used typically in methods or 241 <code><a href="refW.html#with">with</a></code> bodies. <code>(: ..)</code> is 242 equivalent to <code>(; This ..)</code>. See also <code><a 243 href="ref_.html#;">;</a></code>, <code><a href="ref_.html#=:">=:</a></code> and 244 <code><a href="ref_.html#::">::</a></code>. 245 246 <pre><code> 247 : (put 'X 'a 1) 248 -> 1 249 : (with 'X (: a)) 250 -> 1 251 </code></pre> 252 253 <dt><a name="::"><code>(:: sym [sym1|cnt .. sym2]) -> var</code></a> 254 <dd>Fetches a property for a property key <code>sym</code> or <code>sym2</code> 255 from a symbol. That symbol is <code>This</code> (if no other arguments are 256 given), or a symbol found by applying the <code><a 257 href="refG.html#get">get</a></code> algorithm to <code>This</code> and the 258 following arguments. The property (the cons pair, not just its value) is 259 returned, suitable for direct (destructive) manipulations with functions 260 expecting a <code>var</code> argument. Used typically in methods or <code><a 261 href="refW.html#with">with</a></code> bodies. See also <code><a 262 href="ref_.html#=:">=:</a></code>, <code><a 263 href="refP.html#prop">prop</a></code> and <code><a 264 href="ref_.html#:">:</a></code>. 265 266 <pre><code> 267 : (with 'X (=: cnt 0) (inc (:: cnt)) (: cnt)) 268 -> 1 269 </code></pre> 270 271 <dt><a name=";"><code>(; 'sym1|lst [sym2|cnt ..]) -> any</code></a> 272 <dd>Fetches a value <code>any</code> from the properties of a symbol, or from a 273 list, by applying the <code><a href="refG.html#get">get</a></code> algorithm to 274 <code>sym1|lst</code> and the following arguments. See also <code><a 275 href="ref_.html#:">:</a></code>, <code><a href="ref_.html#=:">=:</a></code> and 276 <code><a href="ref_.html#::">::</a></code>. 277 278 <pre><code> 279 : (put 'A 'a 1) 280 -> 1 281 : (put 'A 'b 'B) 282 -> B 283 : (put 'B 'c 7) 284 -> 7 285 : (; 'A a) 286 -> 1 287 : (; 'A b c) 288 -> 7 289 </code></pre> 290 291 <dt><a name="<"><code>(< 'any ..) -> flg</code></a> 292 <dd>Returns <code>T</code> when all arguments <code>any</code> are in strictly 293 increasing order. See also <a href="ref.html#cmp">Comparing</a>. 294 295 <pre><code> 296 : (< 3 4) 297 -> T 298 : (< 'a 'b 'c) 299 -> T 300 : (< 999 'a) 301 -> T 302 </code></pre> 303 304 <dt><a name="<="><code>(<= 'any ..) -> flg</code></a> 305 <dd>Returns <code>T</code> when all arguments <code>any</code> are in strictly 306 non-decreasing order. See also <a href="ref.html#cmp">Comparing</a>. 307 308 <pre><code> 309 : (<= 3 3) 310 -> T 311 : (<= 1 2 3) 312 -> T 313 : (<= "abc" "abc" "def") 314 -> T 315 </code></pre> 316 317 <dt><a name="<>"><code>(<> 'any ..) -> flg</code></a> 318 <dd>Returns <code>T</code> when not all <code>any</code> arguments are equal 319 (structure equality). <code>(<> 'any ..)</code> is equivalent to <code>(not (= 320 'any ..))</code>. See also <a href="ref.html#cmp">Comparing</a>. 321 322 <pre><code> 323 : (<> 'a 'b) 324 -> T 325 : (<> 'a 'b 'b) 326 -> T 327 : (<> 'a 'a 'a) 328 -> NIL 329 </code></pre> 330 331 <dt><a name="="><code>(= 'any ..) -> flg</code></a> 332 <dd>Returns <code>T</code> when all <code>any</code> arguments are equal 333 (structure equality). See also <a href="ref.html#cmp">Comparing</a>. 334 335 <pre><code> 336 : (= 6 (* 1 2 3)) 337 -> T 338 : (= "a" "a") 339 -> T 340 : (== "a" "a") 341 -> T 342 : (= (1 (2) 3) (1 (2) 3)) 343 -> T 344 </code></pre> 345 346 <dt><a name="=0"><code>(=0 'any) -> 0 | NIL</code></a> 347 <dd>Returns <code>0</code> when <code>any</code> is a number with value zero. 348 See also <code><a href="refN.html#n0">n0</a></code>, <code><a 349 href="refL.html#lt0">lt0</a></code>, <code><a 350 href="refL.html#le0">le0</a></code>, <code><a 351 href="refG.html#ge0">ge0</a></code> and <code><a 352 href="refG.html#gt0">gt0</a></code>. 353 354 <pre><code> 355 : (=0 (- 6 3 2 1)) 356 -> 0 357 : (=0 'a) 358 -> NIL 359 </code></pre> 360 361 <dt><a name="=:"><code>(=: sym|0 [sym1|cnt .. sym2|0] 'any)</code></a> 362 <dd>Stores a new value <code>any</code> for a property key <code>sym</code> or 363 <code>sym2</code> (or in the symbol value for zero) in a symbol. That symbol is 364 <code>This</code> (if no other arguments are given), or a symbol found by 365 applying the <code><a href="refG.html#get">get</a></code> algorithm to 366 <code>This</code> and the following arguments. Used typically in methods or 367 <code><a href="refW.html#with">with</a></code> bodies. See also <code><a 368 href="refP.html#put">put</a></code>, <code><a href="ref_.html#:">:</a></code> 369 and <code><a href="ref_.html#::">::</a></code>. 370 371 <pre><code> 372 : (with 'X (=: a 1) (=: b 2)) 373 -> 2 374 : (get 'X 'a) 375 -> 1 376 : (get 'X 'b) 377 -> 2 378 </code></pre> 379 380 <dt><a name="=="><code>(== 'any ..) -> flg</code></a> 381 <dd>Returns <code>T</code> when all <code>any</code> arguments are the same 382 (pointer equality). See also <code><a href="refN.html#n==">n==</a></code> and <a 383 href="ref.html#cmp">Comparing</a>. 384 385 <pre><code> 386 : (== 'a 'a) 387 -> T 388 : (== 'NIL NIL (val NIL) (car NIL) (cdr NIL)) 389 -> T 390 : (== (1 2 3) (1 2 3)) 391 -> NIL 392 </code></pre> 393 394 <dt><a name="===="><code>(==== ['sym ..]) -> NIL</code></a> 395 <dd>Close the current transient scope by clearing the transient index. All 396 transient symbols become hidden and inaccessible by the reader. Then any 397 optional <code>sym</code> arguments are (re-)inserted into the transient index. 398 See also <code><a href="refE.html#extern">extern</a></code> and <code><a 399 href="refI.html#intern">intern</a></code>. 400 401 <pre><code> 402 : (setq S "abc") # Read "abc" 403 -> "abc" 404 : (== S "abc") # Read again, get the same symbol 405 -> T 406 : (====) # Close scope 407 -> NIL 408 : (== S "abc") # Read again, get another symbol 409 -> NIL 410 </code></pre> 411 412 <dt><a name="=T"><code>(=T 'any) -> flg</code></a> 413 <dd>Returns <code>T</code> when <code>any</code> is the symbol <code>T</code>. 414 <code>(=T X)</code> is equivalent to <code>(== T X)</code>. See also <a 415 href="refN.html#nT">nT</a>. 416 417 <pre><code> 418 : (=T 0) 419 -> NIL 420 : (=T "T") 421 -> NIL 422 : (=T T) 423 -> T 424 </code></pre> 425 426 <dt><a name=">"><code>(> 'any ..) -> flg</code></a> 427 <dd>Returns <code>T</code> when all arguments <code>any</code> are in strictly 428 decreasing order. See also <a href="ref.html#cmp">Comparing</a>. 429 430 <pre><code> 431 : (> 4 3) 432 -> T 433 : (> 'A 999) 434 -> T 435 </code></pre> 436 437 <dt><a name=">="><code>(>= 'any ..) -> flg</code></a> 438 <dd>Returns <code>T</code> when all arguments <code>any</code> are in strictly 439 non-increasing order. See also <a href="ref.html#cmp">Comparing</a>. 440 441 <pre><code> 442 : (>= 'A 999) 443 -> T 444 : (>= 3 2 2 1) 445 -> T 446 </code></pre> 447 448 <dt><a name=">>"><code>(>> 'cnt 'num) -> num</code></a> 449 <dd>Shifts right the <code>num</code> argument by <code>cnt</code> 450 bit-positions. If <code>cnt</code> is negative, a corresponding left shift is 451 performed. 452 453 <pre><code> 454 : (>> 1 8) 455 -> 4 456 : (>> 3 16) 457 -> 2 458 : (>> -3 16) 459 -> 128 460 : (>> -1 -16) 461 -> -32 462 </code></pre> 463 464 <dt><a name="?"><code>(? [sym ..] [pat 'any ..] . lst) -> flg</code></a> 465 <dd>Top-level function for interactive <a href="ref.html#pilog">Pilog</a> 466 queries. <code>?</code> is a non-evaluating front-end to the <code><a 467 href="refQ.html#query">query</a></code> function. It displays each result, waits 468 for console input, and terminates when a non-empty line is entered. If a 469 preceding list of (non-pattern-) symbols is given, they will be taken as rules 470 to be traced by <code><a href="refP.html#prove">prove</a></code>. The list of 471 variable/value pairs is passed to <code><a href="refG.html#goal">goal</a></code> 472 for an initial Pilog environment. See also <code><a 473 href="refP.html#pilog">pilog</a></code> and <code><a 474 href="refS.html#solve">solve</a></code>. 475 476 <pre><code> 477 : (? (append (a b c) (d e f) @X)) 478 @X=(a b c d e f) 479 -> NIL 480 481 : (? (append @X @Y (a b c))) 482 @X=NIL @Y=(a b c) 483 @X=(a) @Y=(b c) 484 @X=(a b) @Y=(c) 485 @X=(a b c) @Y=NIL 486 -> NIL 487 488 : (? (append @X @Y (a b c))) 489 @X=NIL @Y=(a b c). # Stopped 490 -> NIL 491 492 : (? append (append @X @Y (a b c))) # Trace 'append' 493 1 (append NIL (a b c) (a b c)) 494 @X=NIL @Y=(a b c) 495 2 (append (a . @X) @Y (a b c)) 496 1 (append NIL (b c) (b c)) 497 @X=(a) @Y=(b c). # Stopped 498 -> NIL 499 </code></pre> 500 501 <dt><a name="@"><code>@</code></a> 502 <dd>Holds the result of the last top level expression in the current 503 read-eval-print loop, or the result of the conditional expression during the 504 evaluation of flow functions (see <code><a href="ref.html#atres">@ 505 Result</a></code>). When <code>@</code> is used as a formal parameter in <a 506 href="ref.html#lambda">lambda expressions</a>, it denotes a variable number of 507 evaluated arguments. 508 509 <dt><a name="@@"><code>@@</code></a> 510 <dd>Holds the result of the second last top level expression in the current 511 read-eval-print loop (see <code><a href="ref.html#atres">@ Result</a></code>). 512 513 <dt><a name="@@@"><code>@@@</code></a> 514 <dd>Holds the result of the third last top level expression in the current 515 read-eval-print loop (see <code><a href="ref.html#atres">@ Result</a></code>). 516 517 <dt><a name="^"><code>^</code></a> 518 <dd>Holds the currently executed expression during a breakpoint or an error. See 519 also <code><a href="refD.html#debug">debug</a></code>, <code><a 520 href="ref_.html#!">!</a></code>, <code><a href="refE.html#e">e</a></code> and 521 <code><a href="refD.html#*Dbg">*Dbg</a></code>. 522 523 <pre><code> 524 : (* (+ 3 4) (/ 7 0)) 525 !? (/ 7 0) 526 Div/0 527 ? ^ 528 -> (/ 7 0) 529 </code></pre> 530 531 <dt><a name="|"><code>(| 'num ..) -> num</code></a> 532 <dd>Returns the bitwise <code>OR</code> of all <code>num</code> arguments. When 533 one of the arguments evaluates to <code>NIL</code>, it is returned immediately. 534 See also <code><a href="refX.html#x|">x|</a></code>, <code><a 535 href="ref_.html#&">&</a></code> and <code><a 536 href="refB.html#bit?">bit?</a></code>. 537 538 <pre><code> 539 : (| 1 2) 540 -> 3 541 : (| 1 2 4 8) 542 -> 15 543 </code></pre> 544 545 </dl> 546 547 </body> 548 </html>