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 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705
|
<!--
# VIP @lib/vip/html.l
# 30may25 Software Lab. Alexander Burger
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>F</title>
<link rel="stylesheet" href="doc.css" type="text/css">
</head>
<body>
<h1>F</h1>
<dl>
<dt><a id="*Fork"><code>*Fork</code></a></dt>
<dd>A global variable holding a (possibly empty) <code>prg</code> body, to be
executed after a call to <code><a href="refF.html#fork">fork</a></code> in the
child process.
<pre>
: (push '*Fork '(off *Tmp)) # Clear '*Tmp' in child process
-> (off *Tmp)
</pre></dd>
<dt><a id="+Fold"><code>+Fold</code></a></dt>
<dd>Prefix class for maintaining <code><a
href="refF.html#fold">fold</a></code>ed indexes to <code><a
href="refS.html#+String">+String</a></code> relations. Typically used in
combination with the <code><a href="refR.html#+Ref">+Ref</a></code> or <code><a
href="refI.html#+Idx">+Idx</a></code> prefix classes. See also <code><a
href="refI.html#+IdxFold">+IdxFold</a></code> and <a
href="ref.html#dbase">Database</a>.
<pre>
(rel nm (+Fold +Idx +String)) # Item Description
...
(rel tel (+Fold +Ref +String)) # Phone number
</pre></dd>
<dt><a id="fail"><code>(fail) -> lst</code></a></dt>
<dd>Constructs an empty <a href="ref.html#pilog">Pilog</a> query, i.e. a query
that will always fail. See also <code><a href="refG.html#goal">goal</a></code>.
<pre>
(dm clr> () # Clear query chart in search dialogs
(query> This (fail)) )
</pre></dd>
<dt><a id="fail/0"><code>fail/0</code></a></dt>
<dd><a href="ref.html#pilog">Pilog</a> predicate that always fails. See also
<code><a href="refT.html#true/0">true/0</a></code>.
<pre>
: (? (fail))
-> NIL
</pre></dd>
<dt><a id="fd"><code>(fd ['cnt]) -> cnt</code></a></dt>
<dd>Return the current file descriptor, typically of the closest <code><a
href="refI.html#in">in</a></code> or <code><a
href="refO.html#out">out</a></code> channel. If a second file descriptor
<code>cnt</code> is given, the current file descriptor is copied to it using a
<code>dup2()</code> system call. See also <code><a
href="refI.html#ipid">ipid</a></code> and <code><a
href="refO.html#opid">opid</a></code>.
<pre>
: (in "@lib.l" (fd))
-> 3
</pre></dd>
<dt><a id="fetch"><code>(fetch 'tree 'any) -> any</code></a></dt>
<dd>Fetches a value for the key <code>any</code> from a database tree. See also
<code><a href="refT.html#tree">tree</a></code> and <code><a
href="refS.html#store">store</a></code>.
<pre>
: (fetch (tree 'nr '+Item) 2)
-> {B2}
</pre></dd>
<dt><a id="fifo"><code>(fifo 'var ['any ..]) -> any</code></a></dt>
<dd>Implements a first-in-first-out structure using a circular list. When called
with <code>any</code> arguments, they will be concatenated to end of the
structure. Otherwise, the first element is removed from the structure and
returned. See also <code><a href="refQ.html#queue">queue</a></code>, <code><a
href="refP.html#push">push</a></code>, <code><a
href="refP.html#pop">pop</a></code>, <code><a
href="refR.html#rid">rid</a></code>, <code><a
href="refR.html#rot">rot</a></code> and <code><a
href="refC.html#circ">circ</a></code>.
<pre>
: (fifo 'X 1)
-> 1
: (fifo 'X 2 3)
-> 3
: X
-> (3 1 2 .)
: (fifo 'X)
-> 1
: (fifo 'X)
-> 2
: X
-> (3 .)
</pre></dd>
<dt><a id="file"><code>(file) -> (sym1 sym2 . num) | NIL</code></a></dt>
<dd>Returns for the current input channel the path name <code>sym1</code>, the
file name <code>sym2</code>, and the current line number <code>num</code>. If
the current input channel is not a file, <code>NIL</code> is returned. See also
<code><a href="refI.html#info">info</a></code>, <code><a
href="refI.html#in">in</a></code> and <code><a
href="refL.html#load">load</a></code>.
<pre>
: (load (pack (car (file)) "localFile.l")) # Load a file in same directory
</pre></dd>
<dt><a id="fill"><code>(fill 'any ['sym|lst]) -> any</code></a></dt>
<dt><code>(fill 'any ['cnt|sym] 'any2) -> any</code></dt>
<dd>Non-destructively fills a pattern <code>any</code>, by substituting
<code>sym</code>, or all symbols in <code>lst</code>, or - if no second argument
is given - each pattern symbol in <code>any</code> (see <code><a
href="refP.html#pat?">pat?</a></code>), with its current value. <code>@</code>
itself is not considered a pattern symbol here. In any case, expressions
following the symbol <code>^</code> are evaluated and the results
(destructively) spliced into the result. In the second form, all occurrences of
the second argument are simply replaced by <code>any2</code>. In both cases,
unmodified subexpressions are shared.
See also <code><a href="refM.html#match">match</a></code>.
<pre>
: (setq @X 1234 @Y (1 2 3 4))
-> (1 2 3 4)
: (fill '@X)
-> 1234
: (fill '(a b (c @X) ((@Y . d) e)))
-> (a b (c 1234) (((1 2 3 4) . d) e))
: (let X 2 (fill (1 X 3) 'X))
-> (1 2 3)
: (fill (1 ^(list 'a 'b 'c) 9))
-> (1 a b c 9)
: (fill (1 ^(+ 2 3) 7))
-> (1 5 7)
: (fill (1 (a (b . 2) c) 3) 'b 7)
-> (1 (a (7 . 2) c) 3)
: (fill (1 (a (b . 2) c) 3) 2 123)
-> (1 (a (b . 123) c) 3)
: (match '(This is @X) '(This is a pen))
-> T
: (fill '(Got ^ @X))
-> (Got a pen)
</pre></dd>
<dt><a id="filter"><code>(filter 'fun 'lst ..) -> lst</code></a></dt>
<dd>Applies <code>fun</code> to each element of <code>lst</code>. When
additional <code>lst</code> arguments are given, their elements are also passed
to <code>fun</code>. Returns a list of all elements of <code>lst</code> where
<code>fun</code> returned non-<code>NIL</code>. See also <code><a
href="refF.html#fish">fish</a></code>, <code><a
href="refF.html#find">find</a></code>, <code><a
href="refP.html#pick">pick</a></code> and <code><a
href="refE.html#extract">extract</a></code>.
<pre>
: (filter num? (1 A 2 (B) 3 CDE))
-> (1 2 3)
: (filter < (2 9 3 8 4 7) (5 4 3 9 9 5))
-> (2 8 4)
: (filter and (1 NIL 3 NIL 5) (2 3 4 5 6) (7 8 NIL 1 1))
-> (1 5)
: (filter and (range 1 22) '(NIL NIL T .))
-> (3 6 9 12 15 18 21)
</pre></dd>
<dt><a id="fin"><code>(fin 'any) -> num|sym</code></a></dt>
<dd>Returns <code>any</code> if it is an atom, otherwise the CDR of its last
cell. See also <code><a href="refL.html#last">last</a></code> and <code><a
href="refT.html#tail">tail</a></code>.
<pre>
: (fin 'a)
-> a
: (fin '(a . b))
-> b
: (fin '(a b . c))
-> c
: (fin '(a b c))
-> NIL
</pre></dd>
<dt><a id="finally"><code>(finally exe . prg) -> any</code></a></dt>
<dd><code>prg</code> is executed, then <code>exe</code> is evaluated, and the
result of <code>prg</code> is returned. <code>exe</code> will also be evaluated
if <code>prg</code> does not terminate normally due to a runtime error or a call
to <code><a href="refT.html#throw">throw</a></code>. See also <code><a
href="refB.html#bye">bye</a></code>, <code><a
href="refC.html#catch">catch</a></code>, <code><a
href="refQ.html#quit">quit</a></code> and <code><a href="ref.html#errors">Error
Handling</a></code>.
<pre>
: (finally (prinl "Done!")
(println 123)
(quit)
(println 456) )
123
Done!
: (catch 'A
(finally (prinl "Done!")
(println 1)
(throw 'A 123)
(println 2) ) )
1
Done!
-> 123
</pre></dd>
<dt><a id="find"><code>(find 'fun 'lst ..) -> any</code></a></dt>
<dd>Applies <code>fun</code> to successive elements of <code>lst</code> until
non-<code>NIL</code> is returned. Returns that element (and stores the
non-<code>NIL</code> value in the global variable <code><a
href="ref_.html#@@">@@</a></code>), or <code>NIL</code> if <code>fun</code> did
not return non-<code>NIL</code> for any element of <code>lst</code>. When
additional <code>lst</code> arguments are given, their elements are also passed
to <code>fun</code>. See also <code><a href="refS.html#seek">seek</a></code>,
<code><a href="refP.html#pick">pick</a></code>, <code><a
href="refF.html#fully">fully</a></code> and <code><a
href="refF.html#filter">filter</a></code>.
<pre>
: (find pair (1 A 2 (B) 3 CDE))
-> (B)
: (find '((A B) (> A B)) (1 2 3 4 5 6) (6 5 4 3 2 1))
-> 4
: (find > (1 2 3 4 5 6) (6 5 4 3 2 1)) # shorter
-> 4
</pre></dd>
<dt><a id="finish"><code>(finish . prg) -> exe</code></a></dt>
<dd>Pushes the expressions in <code>prg</code> into the global <code><a
href="refB.html#*Bye">*Bye</a></code> in reverse order, to be executed just
before the termination of the PicoLisp interpreter. <code>(finish (foo)
(bar))</code> is equivalent to <code>(push '*Bye '(bar) '(foo))</code> See also
<code><a href="refB.html#bye">bye</a></code> and <code><a
href="refO.html#once">once</a></code>.
<pre>
: (finish (call "rm" "myfile.tmp")) # Remove a temporary file
-> (call 'rm "myfile.tmp")
</pre></dd>
<dt><a id="fish"><code>(fish 'fun 'any ['any2] ..) -> lst</code></a></dt>
<dd>Applies <code>fun</code> to each element - and recursively to all sublists -
of <code>any</code>. Returns a list of all items where <code>fun</code> returned
non-<code>NIL</code>. If <code>any2</code> is non-<code>NIL</code>, it may be
returned by <code>fun</code> to cause the corresponding item or (sub-)list to be
skipped. When additional <code>any</code> arguments are given, they are also
passed to <code>fun</code>. See also <code><a
href="refS.html#seek">seek</a></code>,
See also <code><a href="refF.html#filter">filter</a></code>.
<pre>
: (fish atom '((a b) c (d e)))
-> (a b c d e)
: (fish sym? '(a -2 (1 b (-3 c 2)) 3 d -1 7))
-> (a b c d)
: (fish gt0 '(a -2 (1 b (-3 c 2)) 3 d -1 7))
-> (1 2 3 7)
: (fish < '(a -2 (1 b (-3 c 2)) 3 d -1 7) NIL 2)
-> (-2 1 -3 -1)
: (fish
'((X)
(if (and (pair X) (=1 (car X)))
"skip" # Transient symbol (pointer equal)
(gt0 X) ) )
'(a -2 (1 b (-3 c 2)) 3 d -1 7)
"skip" )
-> (3 7)
: (fish == '(a 1 (b (3 b)) 3) NIL 'b)
-> (b b)
</pre></dd>
<dt><a id="flg?"><code>(flg? 'any) -> flg</code></a></dt>
<dd>Returns <code>T</code> when the argument <code>any</code> is either
<code>NIL</code> or <code>T</code>. See also <code><a
href="refB.html#bool">bool</a></code>. <code>(flg? X)</code> is equivalent to
<code>(or (not X) (=T X))</code>.
<pre>
: (flg? (= 3 3))
-> T
: (flg? (= 3 4))
-> T
: (flg? (+ 3 4))
-> NIL
</pre></dd>
<dt><a id="flip"><code>(flip 'lst ['cnt]) -> lst</code></a></dt>
<dd>Returns <code>lst</code> (destructively) reversed. Without the optional
<code>cnt</code> argument, the whole list is flipped, otherwise only the first
<code>cnt</code> elements. See also <code><a
href="refR.html#reverse">reverse</a></code> and <code><a
href="refR.html#rot">rot</a></code>.
<pre>
: (flip (1 2 3 4)) # Flip all four elements
-> (4 3 2 1)
: (flip (1 2 3 4 5 6) 3) # Flip only the first three elements
-> (3 2 1 4 5 6)
</pre></dd>
<dt><a id="flood"><code>(flood 'lst1 'fun 'lst2) -> lst</code></a></dt>
<dd>Implements a flooding algorithm, returning a list of flooded nodes of a
graph. <code>lst1</code> is a list of relevant nodes, <code>fun</code> a
function accepting a node and returning a list of connected nodes, and
<code>lst2</code> a list of seed nodes.
<pre>
(load "@lib/simul.l")
: (setq *Graph (1 2 3 4 5)) # For simplicity, a one-dimensional "graph"
-> (1 2 3 4 5)
: (simul~flood
(maplist prog *Graph) # List of relevant cells
'((X) # Flood the three central cells (2 3 4)
(when (member (car X) (2 3)) # 2 -> 3 and 3 -> 4
(list (cdr X)) ) )
(list (cddr *Graph)) ) # Seed third (middle) cell
-> ((3 4 5) (2 3 4 5) (4 5)) # -> Cells (3 ..) (2 ..) (4 ..)
</pre></dd>
<dt><a id="flush"><code>(flush) -> flg</code></a></dt>
<dd>Flushes the current output stream by writing all buffered data. A call to
<code>flush</code> for standard output is done automatically before a call to
<code><a href="refK.html#key">key</a></code>. Returns <code>T</code> when
successful. See also <code><a href="refR.html#rewind">rewind</a></code>.
<pre>
: (flush)
-> T
</pre></dd>
<dt><a id="fold"><code>(fold 'any ['cnt]) -> sym</code></a></dt>
<dd>Folding to a canonical form: If <code>any</code> is not a symbol, it is
returned as it is. Otherwise, a new transient symbol with all digits and all
letters of <code>any</code>, converted to lower case, is returned. If the
<code>cnt</code> argument is given and non-zero, the result is truncated to that
length. See also <code><a href="refL.html#lowc">lowc</a></code>.
<pre>
: (fold " 1A 2-b/3")
-> "1a2b3"
: (fold " 1A 2-B/3" 3)
-> "1a2"
</pre></dd>
<dt><a id="fold/3"><code>fold/3</code></a></dt>
<dd>(Deprecated since version 25.5.30) <a
href="ref.html#pilog">Pilog</a> predicate that succeeds if the first
argument, after <code><a href="refF.html#fold">fold</a></code>ing it to
a canonical form, is a <i>prefix</i> of the folded string representation
of the result of applying the <code><a
href="refG.html#get">get</a></code> algorithm to the following
arguments. Typically used as filter predicate in <code><a
href="refS.html#select/3">select/3</a></code> database queries. See also
<code><a href="refP.html#pre?">pre?</a></code>, <code><a
href="refI.html#isa/2">isa/2</a></code>, <code><a
href="refS.html#same/3">same/3</a></code>, <code><a
href="refB.html#bool/3">bool/3</a></code>, <code><a
href="refR.html#range/3">range/3</a></code>, <code><a
href="refH.html#head/3">head/3</a></code>, <code><a
href="refP.html#part/3">part/3</a></code> and <code><a
href="refT.html#tolr/3">tolr/3</a></code>.
<pre>
: (?
@Nr (1 . 5)
@Nm "main"
(select (@Item)
((nr +Item @Nr) (nm +Item @Nm))
(range @Nr @Item nr)
(fold @Nm @Item nm) ) )
@Nr=(1 . 5) @Nm="main" @Item={B1}
-> NIL
</pre></dd>
<dt><a id="for"><code>(for sym 'num ['any | (NIL 'any . prg) | (T 'any . prg) ..]) -> any</code></a></dt>
<dt><code>(for sym|(sym2 . sym) 'lst ['any | (NIL 'any . prg) | (T 'any . prg) ..]) -> any</code></dt>
<dt><code>(for (sym|(sym2 . sym) 'any1 'any2 [. prg]) ['any | (NIL 'any . prg) | (T 'any . prg) ..]) -> any</code></dt>
<dd>Conditional loop with local variable(s) and multiple conditional exits:<br>
In the first form, the value of <code>sym</code> is saved, <code>sym</code> is
bound to <code>1</code>, and the body is executed with increasing values up to
(and including) <code>num</code>.<br>
In the second form, the value of <code>sym</code> is saved, <code>sym</code> is
subsequently bound to the elements of <code>lst</code>, and the body is executed
each time.<br>
In the third form, the value of <code>sym</code> is saved, and <code>sym</code>
is bound to <code>any1</code>. If <code>sym2</code> is given, it is treated as a
counter variable, first bound to 1 and then incremented for each execution of
the body. While the condition <code>any2</code> evaluates to
non-<code>NIL</code>, the body is repeatedly executed and, if <code>prg</code>
is given, <code>sym</code> is re-bound to the result of its evaluation.<br>
If a clause has <code>NIL</code> or <code>T</code> as its CAR, the clause's
second element is evaluated as a condition and - if the result is
<code>NIL</code> or non-<code>NIL</code>, respectively - the <code>prg</code> is
executed and the result returned. If the body is never executed,
<code>NIL</code> is returned.<br>
See also <code><a href="refD.html#do">do</a></code> and <code><a
href="refL.html#loop">loop</a></code>.
<pre>
# First form:
: (for N 5 (printsp N))
1 2 3 4 5 -> 5
: (for N 5 (printsp N) (NIL (< N 3) (printsp 'enough)))
1 2 3 enough -> enough
: (for N 5 (T (> N 3) (printsp 'enough)) (printsp N))
1 2 3 enough -> enough
# Second form:
: (for X (1 a 2 b) (printsp X))
1 a 2 b -> b
: (for (I . X) '(a b c) (println I X))
1 a
2 b
3 c
-> c
# Third form:
: (for (L (1 2 3 4 5) L) (printsp (pop 'L)))
1 2 3 4 5 -> 5
: (for (N 1 (>= 5 N) (inc N)) (printsp N))
1 2 3 4 5 -> 5
: (for ((I . L) '(a b c d e f) L (cddr L)) (println I L))
1 (a b c d e f)
2 (c d e f)
3 (e f)
-> (e f)
</pre></dd>
<dt><a id="for/2"><code>for/2</code></a></dt>
<dt><a id="for/3"><code>for/3</code></a></dt>
<dt><a id="for/4"><code>for/4</code></a></dt>
<dd><a href="ref.html#pilog">Pilog</a> predicate that generates a sequence of
numbers. See also <code><a href="refF.html#for">for</a></code> and <code><a
href="refR.html#range">range</a></code>.
<pre>
: (? (for @I 3))
@I=1
@I=2
@I=3
-> NIL
: (? (for @I 3 7))
@I=3
@I=4
@I=5
@I=6
@I=7
-> NIL
: (? (for @I 7 3 2))
@I=7
@I=5
@I=3
-> NIL
: (? (for @N T))
@N=1
@N=2
@N=3
...
</pre></dd>
<dt><a id="forall"><code>(forall 'cls . prg) -> any</code></a></dt>
<dt><code>(forall '(cnt . cls) . prg) -> any</code></dt>
<dt><code>(forall 'lst . prg) -> any</code></dt>
<dd>Runs <code>prg</code> on all database objects of the class <code>cls</code>
(as given by the <code><a href="refD.html#dbs">dbs</a></code> definition, or
using the <code>cnt</code>'th database file instead of the <code>dbs</code>
default), or on a <code>lst</code> query structure as returned by <code><a
href="refI.html#init">init</a></code> or <code><a
href="refS.html#search">search</a></code>. In all cases, the global variable
<code><a href="refT.html#This">This</a></code> is bound to each object (and
<code><a href="ref_.html#@@">@@</a></code> is bound to the key in case of
<code>init</code>). See also <code><a href="refS.html#seq">seq</a></code> and
<code><a href="refC.html#collect">collect</a></code>.
<pre>
: (forall '+Item (println (: nr) (: nm)))
1 "Main Part"
2 "Spare Part"
3 "Auxiliary Construction"
4 "Enhancement Additive"
5 "Metal Fittings"
6 "Gadget Appliance"
: (forall (init '(nr . +Item) 2 4)
(println @@ (: nr) (: nm)) )
2 2 "Spare Part"
2 3 "Auxiliary Construction"
2 4 "Enhancement Additive"
: (forall
(search
(1 . 4) '((nr +Item))
"pa" '((nm +Item)) )
(println (: nr) (: nm)) )
1 "Main Part"
2 "Spare Part"
</pre></dd>
<dt><a id="fork"><code>(fork) -> pid | NIL</code></a></dt>
<dd>Forks a child process. Returns <code>NIL</code> in the child, and the
child's process ID <code>pid</code> in the parent. In the child, the
<code>VAL</code> of the global variable <code><a
href="refF.html#*Fork">*Fork</a></code> (should be a <code>prg</code>) is
executed. See also <code><a href="refE.html#exec">exec</a></code>, <code><a
href="refD.html#detach">detach</a></code>, <code><a
href="refK.html#kids">kids</a></code>, <code><a
href="refP.html#pipe">pipe</a></code> and <code><a
href="refT.html#tell">tell</a></code>.
<pre>
: (unless (fork) (do 5 (println 'OK) (wait 1000)) (bye))
-> NIL
OK # Child's output
: OK
OK
OK
OK
</pre></dd>
<dt><a id="format"><code>(format 'num ['cnt ['sym1 ['sym2]]]) -> sym</code></a></dt>
<dt><code>(format 'sym|lst ['cnt ['sym1 ['sym2]]]) -> num</code></dt>
<dd>Converts a number <code>num</code> to a string, or a string
<code>sym|lst</code> to a number. In both cases, optionally a precision
<code>cnt</code>, a decimal-separator <code>sym1</code> and a
thousands-separator <code>sym2</code> can be supplied. Returns
<code>NIL</code> if the conversion is unsuccessful. See also <a
href="ref.html#num-io">Numbers</a>, <code><a
href="refP.html#pad">pad</a></code>, <code><a
href="refH.html#hex">hex</a></code>, <code><a
href="refO.html#oct">oct</a></code>, <code><a
href="refB.html#bin">bin</a></code> and <code><a
href="refR.html#round">round</a></code>.
<pre>
: (format 123456789) # Integer conversion
-> "123456789"
: (format 123456789 2) # Fixed point
-> "1234567.89"
: (format 123456789 2 ",") # Comma as decimal-separator
-> "1234567,89"
: (format 123456789 2 "," ".") # and period as thousands-separator
-> "1.234.567,89"
: (format "123456789") # String to number
-> 123456789
: (format (1 "23" (4 5 6)))
-> 123456
: (format "1234567.89" 4) # scaled to four digits
-> 12345678900
: (format "1.234.567,89") # separators not recognized
-> NIL
: (format "1234567,89" 4 ",")
-> 12345678900
: (format "1.234.567,89" 4 ",") # thousands-separator not recognized
-> NIL
: (format "1.234.567,89" 4 "," ".")
-> 12345678900
</pre></dd>
<dt><a id="free"><code>(free 'cnt) -> (sym . lst)</code></a></dt>
<dd>Returns, for the <code>cnt</code>'th database file, the next available
symbol <code>sym</code> (i.e. the first symbol greater than any symbol in the
database), and the list <code>lst</code> of free symbols. See also <code><a
href="refS.html#seq">seq</a></code>, <code><a
href="refZ.html#zap">zap</a></code> and <code><a
href="refD.html#dbck">dbck</a></code>.
<pre>
: (pool "x") # A new database
-> T
: (new T) # Create a new symbol
-> {2}
: (new T) # Create another symbol
-> {3}
: (commit) # Commit changes
-> T
: (zap '{2}) # Delete the first symbol
-> {2}
: (free 1) # Show free list
-> ({4}) # {3} was the last symbol allocated
: (commit) # Commit the deletion of {2}
-> T
: (free 1) # Now {2} is in the free list
-> ({4} {2})
</pre></dd>
<dt><a id="from"><code>(from 'any ..) -> sym</code></a></dt>
<dd>Skips the current input channel until one of the strings <code>any</code> is
found, and starts subsequent reading from that point. The found <code>any</code>
argument (or <code>NIL</code> if none is found) is returned. See also <code><a
href="refT.html#till">till</a></code> and <code><a
href="refE.html#echo">echo</a></code>.
<pre>
: (and (from "val='") (till "'" T))
test val='abc'
-> "abc"
</pre></dd>
<dt><a id="full"><code>(full 'any) -> bool</code></a></dt>
<dd>Returns <code>NIL</code> if <code>any</code> is a non-empty list with at
least one <code>NIL</code> element, otherwise <code>T</code>. <code>(full
X)</code> is equivalent to <code>(not (memq NIL X))</code>. See also <code><a
href="refF.html#fully">fully</a></code>.
<pre>
: (full (1 2 3))
-> T
: (full (1 NIL 3))
-> NIL
: (full 123)
-> T
</pre></dd>
<dt><a id="fully"><code>(fully 'fun 'lst ..) -> flg</code></a></dt>
<dd>Applies <code>fun</code> to successive elements of <code>lst</code>, and
returns <code>NIL</code> immediately if one of the results is <code>NIL</code>.
Otherwise, <code>T</code> is returned. When additional <code>lst</code>
arguments are given, their elements are also passed to <code>fun</code>.
<code>(fully foo Lst)</code> is equivalent to <code>(not (find '((X) (not (foo
X))) Lst))</code>. See also <code><a href="refF.html#find">find</a></code> and
<code><a href="refF.html#full">full</a></code>.
<pre>
: (fully gt0 (1 2 3))
-> T
: (fully gt0 (1 -2 3))
-> NIL
</pre></dd>
<dt><a id="fun"><code>(fun 'fun ['any ..]) -> any</code></a></dt>
<dd>Applies <code>fun</code> to the <code>any</code> arguments. <code>(fun foo
'args)</code> is equivalent to <code>(foo 'args)</code>, and <code>(fun (expr)
'args)</code> is equivalent to <code>((expr) 'args)</code>. See also <code><a
href="refA.html#apply">apply</a></code> and <code><a
href="refP.html#pass">pass</a></code>.
<pre>
: (find fun '(sym? ((X) (> X 3)) num?) 'a)
-> sym?
: (find fun '(sym? ((X) (> X 3)) num?) 3)
-> num?
: (find fun '(sym? ((X) (> X 3)) num?) 4)
-> ((X) (> X 3))
</pre></dd>
<dt><a id="fun?"><code>(fun? 'any) -> any</code></a></dt>
<dd>Returns <code>NIL</code> when the argument <code>any</code> is neither a
number suitable for a code-pointer, nor a list suitable for a lambda expression
(function). Otherwise a number is returned for a code-pointer, <code>T</code>
for a function without arguments, and a single formal parameter or a list of
formal parameters for a function. See also <code><a
href="refG.html#getd">getd</a></code>.
<pre>
: (fun? 1000000000) # Might be a code pointer
-> 1000000000
: (fun? 10000000000000000000) # Too big for a code pointer
-> NIL
: (fun? '((A B) (* A B))) # Lambda expression
-> (A B)
: (fun? '((A B) (* A B) . C)) # Not a lambda expression
-> NIL
: (fun? '(1 2 3 4)) # Not a lambda expression
-> NIL
: (fun? '((A 2 B) (* A B))) # Not a lambda expression
-> NIL
</pre></dd>
</dl>
</body>
</html>
|