ref.html (96141B)
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>PicoLisp Reference</title> 6 <link rel="stylesheet" href="doc.css" type="text/css"> 7 </head> 8 <body> 9 <a href="mailto:abu@software-lab.de">abu@software-lab.de</a> 10 11 <p align=right> 12 <i>Perfection is attained</i><br> 13 <i>not when there is nothing left to add</i><br> 14 <i>but when there is nothing left to take away</i><br> 15 <i>(Antoine de Saint-Exupéry)</i><br> 16 17 18 <h1>The PicoLisp Reference</h1> 19 20 <p align=right>(c) Software Lab. Alexander Burger 21 22 <p>This document describes the concepts, data types, and kernel functions of the 23 <a href="http://software-lab.de/down.html">PicoLisp</a> system. 24 25 <p>This is <i>not</i> a Lisp tutorial. For an introduction to Lisp, a 26 traditional Lisp book like "Lisp" by Winston/Horn (Addison-Wesley 1981) is 27 recommended. Note, however, that there are significant differences between 28 PicoLisp and Maclisp (and even greater differences to Common Lisp). 29 30 <p>Please take a look at the <a href="tut.html">PicoLisp Tutorial</a> for an 31 explanation of some aspects of PicoLisp, and scan through the list of <a 32 href="faq.html">Frequently Asked Questions (FAQ)</a>. 33 34 <p><ul> 35 <li><a href="#intro">Introduction</a> 36 <li><a href="#vm">The PicoLisp Machine</a> 37 <ul> 38 <li><a href="#cell">The Cell</a> 39 <li><a href="#data">Data Types</a> 40 <ul> 41 <li><a href="#number">Numbers</a> 42 <li><a href="#symbol">Symbols</a> 43 <ul> 44 <li><a href="#nilSym">NIL</a> 45 <li><a href="#internal">Internal Symbols</a> 46 <li><a href="#transient">Transient Symbols</a> 47 <li><a href="#external">External Symbols</a> 48 </ul> 49 <li><a href="#lst">Lists</a> 50 </ul> 51 <li><a href="#mem">Memory Management</a> 52 </ul> 53 <li><a href="#penv">Programming Environment</a> 54 <ul> 55 <li><a href="#inst">Installation</a> 56 <li><a href="#invoc">Invocation</a> 57 <li><a href="#io">Input/Output</a> 58 <ul> 59 <li><a href="#num-io">Numbers</a> 60 <li><a href="#sym-io">Symbols</a> 61 <ul> 62 <li><a href="#nilSym-io">NIL</a> 63 <li><a href="#internal-io">Internal Symbols</a> 64 <li><a href="#transient-io">Transient Symbols</a> 65 <li><a href="#external-io">External Symbols</a> 66 </ul> 67 <li><a href="#lst-io">Lists</a> 68 <li><a href="#macro-io">Read-Macros</a> 69 </ul> 70 <li><a href="#ev">Evaluation</a> 71 <li><a href="#int">Interrupt</a> 72 <li><a href="#coroutines">Coroutines</a> 73 <li><a href="#errors">Error Handling</a> 74 <li><a href="#atres">@ Result</a> 75 <li><a href="#cmp">Comparing</a> 76 <li><a href="#oop">OO Concepts</a> 77 <li><a href="#dbase">Database</a> 78 <ul> 79 <li><a href="#trans">Transactions</a> 80 <li><a href="#er">Entities / Relations</a> 81 </ul> 82 <li><a href="#pilog">Pilog (PicoLisp Prolog)</a> 83 <li><a href="#conv">Naming Conventions</a> 84 <li><a href="#trad">Breaking Traditions</a> 85 <li><a href="#bugs">Bugs</a> 86 </ul> 87 <li><a href="#fun">Function Reference</a> 88 <li><a href="#down">Download</a> 89 </ul> 90 91 92 <p><hr> 93 <h2><a name="intro">Introduction</a></h2> 94 95 <p>PicoLisp is the result of a language design study, trying to answer the 96 question "What is a minimal but useful architecture for a virtual machine?". 97 Because opinions differ about what is meant by "minimal" and "useful", there are 98 many answers to that question, and people might consider other solutions more 99 "minimal" or more "useful". But from a practical point of view, PicoLisp has 100 proven to be a valuable answer to that question. 101 102 <p>First of all, PicoLisp is a virtual machine architecture, and then a 103 programming language. It was designed in a "bottom up" way, and "bottom up" is 104 also the most natural way to understand and to use it: <i>Form Follows 105 Function</i>. 106 107 <p>PicoLisp has been used in several commercial and research programming 108 projects since 1988. Its internal structures are simple enough, allowing an 109 experienced programmer always to fully understand what's going on under the 110 hood, and its language features, efficiency and extensibility make it suitable 111 for almost any practical programming task. 112 113 <p>In a nutshell, emphasis was put on four design objectives. The PicoLisp 114 system should be 115 116 <p><dl> 117 118 <dt>Simple 119 <dd>The internal data structure should be as simple as possible. Only one single 120 data structure is used to build all higher level constructs. 121 122 <dt>Unlimited 123 <dd>There are no limits imposed upon the language due to limitations of the 124 virtual machine architecture. That is, there is no upper bound in symbol name 125 length, number digit counts, stack depth, or data structure and buffer sizes, 126 except for the total memory size of the host machine. 127 128 <dt>Dynamic 129 <dd>Behavior should be as dynamic as possible ("run"-time vs. "compile"-time). 130 All decisions are delayed until runtime where possible. This involves matters 131 like memory management, dynamic symbol binding, and late method binding. 132 133 <dt>Practical 134 <dd>PicoLisp is not just a toy of theoretical value. It is in use since 1988 in 135 actual application development, research and production. 136 137 </dl> 138 139 140 <p><hr> 141 <h2><a name="vm">The PicoLisp Machine</a></h2> 142 143 <p>An important point in the PicoLisp philosophy is the knowledge about the 144 architecture and data structures of the internal machinery. The high-level 145 constructs of the programming language directly map to that machinery, making 146 the whole system both understandable and predictable. 147 148 <p>This is similar to assembly language programming, where the programmer has 149 complete control over the machine. 150 151 152 <p><hr> 153 <h3><a name="cell">The Cell</a></h3> 154 155 <p>The PicoLisp virtual machine is both simpler and more powerful than most 156 current (hardware) processors. At the lowest level, it is constructed from a 157 single data structure called "cell": 158 159 <pre><code> 160 +-----+-----+ 161 | CAR | CDR | 162 +-----+-----+ 163 </code></pre> 164 165 <p>A cell is a pair of machine words, which traditionally are called CAR and CDR 166 in the Lisp terminology. These words can represent either a numeric value 167 (scalar) or the address of another cell (pointer). All higher level data 168 structures are built out of cells. 169 170 <p>The type information of higher level data is contained in the pointers to 171 these data. Assuming the implementation on a byte-addressed physical machine, 172 and a pointer size of typically 4 bytes, each cell has a size of 8 bytes. 173 Therefore, the pointer to a cell must point to an 8-byte boundary, and its 174 bit-representation will look like: 175 176 <pre><code> 177 xxxxxxxxxxxxxxxxxxxxxxxxxxxxx000 178 </code></pre> 179 180 <p>(the '<code>x</code>' means "don't care"). For the individual data types, the 181 pointer is adjusted to point to other parts of a cell, in effect setting some of 182 the lower three bits to non-zero values. These bits are then used by the 183 interpreter to determine the data type. 184 185 <p>In any case, bit(0) - the least significant of these bits - is reserved as a 186 mark bit for garbage collection. 187 188 <p>Initially, all cells in the memory are unused (free), and linked together to 189 form a "free list". To create higher level data types at runtime, cells are 190 taken from that free list, and returned by the garbage collector when they are 191 no longer needed. All memory management is done via that free list; there are no 192 additional buffers, string spaces or special memory areas, with two exceptions: 193 194 <p><ul> 195 <li>A certain fixed area of memory is set aside to contain the executable code 196 and global variables of the interpreter itself, and 197 198 <li>a standard push down stack for return addresses and temporary storage. Both 199 are not directly accessible by the programmer). 200 201 </ul> 202 203 <p><hr> 204 <h3><a name="data">Data Types</a></h3> 205 206 <p>On the virtual machine level, PicoLisp supports 207 208 <p><ul> 209 <li>three base data types: Numbers, Symbols and Cons Pairs (Lists), 210 <li>the three scope variations of symbols: Internal, Transient and External, and 211 <li>the special symbol <code>NIL</code>. 212 </ul> 213 214 <p>They are all built from the single cell data structure, and all runtime data 215 cannot consist of any other types than these three. 216 217 <p>The following diagram shows the complete data type hierarchy, consisting of 218 the three base types and the symbol variations: 219 220 <pre><code> 221 cell 222 | 223 +--------+--------+ 224 | | | 225 Number Symbol Pair 226 | 227 | 228 +--------+--------+--------+ 229 | | | | 230 NIL Internal Transient External 231 </code></pre> 232 233 234 <p><hr> 235 <h4><a name="number">Numbers</a></h4> 236 237 <p>A number can represent a signed integral value of arbitrary size. The CARs of 238 one or more cells hold the number's "digits" (each in the machine's word size), 239 to store the number's binary representation. 240 241 <pre><code> 242 Number 243 | 244 V 245 +-----+-----+ 246 | DIG | | | 247 +-----+--+--+ 248 | 249 V 250 +-----+-----+ 251 | DIG | | | 252 +-----+--+--+ 253 | 254 V 255 ... 256 </code></pre> 257 258 <p>The first cell holds the least significant digit. The least significant bit 259 of that digit represents the sign. 260 261 <p>The pointer to a number points into the middle of the CAR, with an offset of 262 2 from the cell's start address. Therefore, the bit pattern of a number will be: 263 264 <pre><code> 265 xxxxxxxxxxxxxxxxxxxxxxxxxxxxx010 266 </code></pre> 267 268 <p>Thus, a number is recognized by the interpreter when bit(1) is non-zero. 269 270 271 <p><hr> 272 <h4><a name="symbol">Symbols</a></h4> 273 274 <p>A symbol is more complex than a number. Each symbol has a value, and 275 optionally a name and an arbitrary number of properties. The CDR of a symbol 276 cell is also called VAL, and the CAR points to the symbol's tail. As a minimum, 277 a symbol consists of a single cell, and has no name or properties: 278 279 <pre><code> 280 Symbol 281 | 282 V 283 +-----+-----+ 284 | / | VAL | 285 +-----+-----+ 286 </code></pre> 287 288 <p>That is, the symbol's tail is empty (points to <code>NIL</code>, as indicated 289 by the '<code>/</code>' character). 290 291 <p>The pointer to a symbol points to the CDR of the cell, with an offset of 4 292 from the cell's start address. Therefore, the bit pattern of a symbol will be: 293 294 <pre><code> 295 xxxxxxxxxxxxxxxxxxxxxxxxxxxxx100 296 </code></pre> 297 298 <p>Thus, a symbol is recognized by the interpreter when bit(2) is non-zero. 299 300 <p>A property is a key-value pair, represented by a cons pair in the symbol's 301 tail. This is called a "property list". The property list may be terminated by a 302 number representing the symbol's name. In the following example, a symbol with 303 the name <code>"abc"</code> has three properties: A KEY/VAL pair, a cell with 304 only a KEY, and another KEY/VAL pair. 305 306 <pre><code> 307 Symbol 308 | 309 V 310 +-----+-----+ 311 | | | VAL | 312 +--+--+-----+ 313 | tail 314 | 315 V name 316 +-----+-----+ +-----+-----+ +-----+-----+ +-----+-----+ 317 | | | ---+---> | KEY | ---+---> | | | ---+---> |'cba'| / | 318 +--+--+-----+ +-----+-----+ +--+--+-----+ +-----+-----+ 319 | | 320 V V 321 +-----+-----+ +-----+-----+ 322 | VAL | KEY | | VAL | KEY | 323 +-----+-----+ +-----+-----+ 324 </code></pre> 325 326 <p>Each property in a symbol's tail is either a symbol (like the single KEY 327 above, then it represents the boolean value <code>T</code>), or a cons pair with 328 the property key in its CDR and the property value in its CAR. In both cases, 329 the key should be a symbol, because searches in the property list are performed 330 using pointer comparisons. 331 332 <p>The name of a symbol is stored as a number at the end of the tail. It 333 contains the characters of the name in UTF-8 encoding, using between one and 334 three 8-bit-bytes per character. The first byte of the first character is stored 335 in the lowest 8 bits of the number. 336 337 <p>All symbols have the above structure, but depending on scope and 338 accessibility there are actually four types of symbols: <code><a 339 href="#nilSym">NIL</a></code>, <a href="#internal">internal</a>, <a 340 href="#transient">transient</a> and <a href="#external">external</a> symbols. 341 342 343 <p><hr> 344 <h5><a name="nilSym">NIL</a></h5> 345 346 <p><code>NIL</code> is a special symbol which exists exactly once in the whole 347 system. It is used 348 349 <p><ul> 350 <li>as an end-of-list marker 351 <li>to represent the empty list 352 <li>to represent the boolean value "false" 353 <li>to represent the absolute minimum 354 <li>to represent a string of length zero 355 <li>to represent the value "Not a Number" 356 <li>as the root of all class hierarchies 357 </ul> 358 359 <p>For that, <code>NIL</code> has a special structure: 360 361 <pre><code> 362 NIL: / 363 | 364 V 365 +-----+-----+-----+-----+ 366 | / | / | / | / | 367 +-----+--+--+-----+-----+ 368 </code></pre> 369 370 <p>The reason for that structure is <code>NIL</code>'s dual nature both as a 371 symbol and as a list: 372 373 <p><ul> 374 <li>As a symbol, it should give <code>NIL</code> for its VAL, and be without 375 properties 376 377 <li>For the empty list, <code>NIL</code> should give <code>NIL</code> both for 378 its CAR and for its CDR 379 380 </ul> 381 382 <p>These requirements are fulfilled by the above structure. 383 384 385 <p><hr> 386 <h5><a name="internal">Internal Symbols</a></h5> 387 388 <p>Internal Symbols are all those "normal" symbols, as they are used for 389 function definitions and variable names. They are "interned" into an index 390 structure, so that it is possible to find an internal symbol by searching for 391 its name. 392 393 <p>There cannot be two different internal symbols with the same name. 394 395 <p>Initially, a new internal symbol's VAL is <code>NIL</code>. 396 397 398 <p><hr> 399 <h5><a name="transient">Transient Symbols</a></h5> 400 401 <p>Transient symbols are only interned into a index structure for a certain time 402 (e.g. while reading the current source file), and are released after that. That 403 means, a transient symbol cannot be accessed then by its name, and there may be 404 several transient symbols in the system having the same name. 405 406 <p>Transient symbols are used 407 408 <p><ul> 409 <li>as text strings 410 411 <li>as identifiers with a limited access scope (like, for example, 412 <code>static</code> identifiers in the C language family) 413 414 <li>as anonymous, dynamically created objects (without a name) 415 416 </ul> 417 418 <p>Initially, a new transient symbol's VAL is that symbol itself. 419 420 <p>A transient symbol without a name can be created with the <code><a 421 href="refB.html#box">box</a></code> or <code><a 422 href="refN.html#new">new</a></code> functions. 423 424 425 <p><hr> 426 <h5><a name="external">External Symbols</a></h5> 427 428 <p>External symbols reside in a database file (or a similar resources, see 429 <code><a href="refE.html#*Ext">*Ext</a></code>), and are loaded into memory - 430 and written back to the file - dynamically as needed, and transparently to the 431 programmer. They are kept in memory ("cached") as long as they are accessible 432 ("referred to") from other parts of the program, or when they were modified but 433 not yet written to the database file (by <code><a 434 href="refC.html#commit">commit</a></code>). 435 436 <p>The interpreter recognizes external symbols internally by an additional tag 437 bit in the tail structure. 438 439 <p>There cannot be two different external symbols with the same name. External 440 symbols are maintained in index structures while they are loaded into memory, 441 and have their external location (disk file and block offset) directly coded 442 into their names (more details <a href="#external-io">here</a>). 443 444 <p>Initially, a new external symbol's VAL is <code>NIL</code>, unless otherwise 445 specified at creation time. 446 447 448 <p><hr> 449 <h4><a name="lst">Lists</a></h4> 450 451 <p>A list is a sequence of one or more cells (cons pairs), holding numbers, 452 symbols, or cons pairs. 453 454 <pre><code> 455 | 456 V 457 +-----+-----+ 458 | any | | | 459 +-----+--+--+ 460 | 461 V 462 +-----+-----+ 463 | any | | | 464 +-----+--+--+ 465 | 466 V 467 ... 468 </code></pre> 469 470 <p>Lists are used in PicoLisp to emulate composite data structures like arrays, 471 trees, stacks or queues. 472 473 <p>In contrast to lists, numbers and symbols are collectively called "Atoms". 474 475 <p>Typically, the CDR of each cell in a list points to the following cell, 476 except for the last cell which points to <code>NIL</code>. If, however, the CDR of 477 the last cell points to an atom, that cell is called a "dotted pair" (because of 478 its I/O syntax with a dot '<code>.</code>' between the two values). 479 480 481 <p><hr> 482 <h3><a name="mem">Memory Management</a></h3> 483 484 <p>The PicoLisp interpreter has complete knowledge of all data in the system, 485 due to the type information associated with every pointer. Therefore, an 486 efficient garbage collector mechanism can easily be implemented. PicoLisp 487 employs a simple but fast mark-and-sweep garbage collector. 488 489 <p>As the collection process is very fast (in the order of milliseconds per 490 megabyte), it was not necessary to develop more complicated, time-consuming and 491 error-prone garbage collection algorithms (e.g. incremental collection). A 492 compacting garbage collector is also not necessary, because the single cell data 493 type cannot cause heap fragmentation. 494 495 496 <p><hr> 497 <h2><a name="penv">Programming Environment</a></h2> 498 499 <p>Lisp was chosen as the programming language, because of its clear and simple 500 structure. 501 502 <p>In some previous versions, a Forth-like syntax was also implemented on top of 503 a similar virtual machine (Lifo). Though that language was more flexible and 504 expressive, the traditional Lisp syntax proved easier to handle, and the virtual 505 machine can be kept considerably simpler. 506 507 PicoLisp inherits the major advantages of classical Lisp systems like 508 509 <p><ul> 510 <li>Dynamic data types and structures 511 <li>Formal equivalence of code and data 512 <li>Functional programming style 513 <li>An interactive environment 514 </ul> 515 516 <p>In the following, some concepts and peculiarities of the PicoLisp language 517 and environment are described. 518 519 520 <p><hr> 521 <h3><a name="inst">Installation</a></h3> 522 523 <p>PicoLisp supports two installation strategies: Local and Global. 524 525 <p>Normally, if you didn't build PicoLisp yourself but installed it with your 526 operating system's package manager, you will have a global installation. This 527 allows system-wide access to the executable and library/documentation files. 528 529 <p>To get a local installation, you can directly download the PicoLisp tarball, 530 and follow the instructions in the INSTALL file. 531 532 <p>A local installation will not interfere in any way with the world outside its 533 directory. There is no need to touch any system locations, and you don't have to 534 be root to install it. Many different versions - or local modifications - of 535 PicoLisp can co-exist on a single machine. 536 537 <p>Note that you are still free to have local installations along with a global 538 installation, and invoke them explicitly as desired. 539 540 <p>Most examples in the following apply to a global installation. 541 542 543 <p><hr> 544 <h3><a name="invoc">Invocation</a></h3> 545 546 <p>When PicoLisp is invoked from the command line, an arbitrary number of 547 arguments may follow the command name. 548 549 <p>By default, each argument is the name of a file to be executed by the 550 interpreter. If, however, the argument's first character is a hyphen 551 '<code>-</code>', then the rest of that argument is taken as a Lisp function 552 call (without the surrounding parentheses), and a hyphen by itself as an 553 argument stops evaluation of the rest of the command line (it may be processed 554 later using the <code><a href="refA.html#argv">argv</a></code> and <code><a 555 href="refO.html#opt">opt</a></code> functions). This whole mechanism corresponds 556 to calling <code>(<a href="refL.html#load">load</a> T)</code>. 557 558 <p>A special case is if the last argument is a single '<code>+</code>'. This 559 will switch on debug mode (the <code><a href="refD.html#*Dbg">*Dbg</a></code> 560 global variable) and discard the '<code>+</code>'. 561 562 <p>As a convention, PicoLisp source files have the extension "<code>.l</code>". 563 564 <p>Note that the PicoLisp executable itself does not expect or accept any 565 command line flags or options (except the '<code>+</code>', see above). They are 566 reserved for application programs. 567 568 <p>The simplest and shortest invocation of PicoLisp does nothing, and exits 569 immediately by calling <code><a href="refB.html#bye">bye</a></code>: 570 571 <pre><code> 572 $ picolisp -bye 573 $ 574 </code></pre> 575 576 <p>In interactive mode, the PicoLisp interpreter (see <code><a 577 href="refL.html#load">load</a></code>) will also exit when <code>Ctrl-D</code> 578 is entered: 579 580 <pre><code> 581 $ picolisp 582 : $ # Typed Ctrl-D 583 </code></pre> 584 585 <p>To start up the standard PicoLisp environment, several files should be 586 loaded. The most commonly used things are in "lib.l" and in a bunch of other 587 files, which are in turn loaded by "ext.l". Thus, a typical call would be: 588 589 <pre><code> 590 $ picolisp lib.l ext.l 591 </code></pre> 592 593 <p>The recommended way, however, is to call the "pil" shell script, which 594 includes "lib.l" and "ext.l". Given that your current project is loaded by some 595 file "myProject.l" and your startup function is <code>main</code>, your 596 invocation would look like: 597 598 <pre><code> 599 $ pil myProject.l -main 600 </code></pre> 601 602 <p>For interactive development it is recommended to enable debugging mode, to 603 get the vi-style line editor, single-stepping, tracing and other debugging 604 utilities. 605 606 <pre><code> 607 $ pil myProject.l -main + 608 </code></pre> 609 610 <p>This is - in a local installation - equivalent to 611 612 <pre><code> 613 $ ./pil myProject.l -main + 614 </code></pre> 615 616 <p>In any case, the directory part of the first file name supplied (normally, 617 the path to "lib.l" as called by 'pil') is remembered internally as the 618 <i>PicoLisp Home Directory</i>. This path is later automatically substituted for 619 any leading "<code>@</code>" character in file name arguments to I/O functions 620 (see <code><a href="refP.html#path">path</a></code>). 621 622 <p>Instead of the default vi-style line editor, an emacs-style editor can be 623 used. It can be switched on permanently by calling the function 624 <code>(em)</code> (i.e. without arguments), or by passing <code>-em</code> on 625 the command line: 626 627 <pre><code> 628 $ pil -em + 629 : 630 </code></pre> 631 632 <p>A single call is enough, because the style will be remembered in a file 633 "~/.pil/editor", and used in all subsequent PicoLisp sessions. 634 635 <p>To switch back to 'vi' style, call <code>(vi)</code>, use the 636 <code>-vi</code> command line option, or simply remove "~/.pil/editor". 637 638 639 <p><hr> 640 <h3><a name="io">Input/Output</a></h3> 641 642 <p>In Lisp, each internal data structure has a well-defined external 643 representation in human-readable format. All kinds of data can be written to a 644 file, and restored later to their original form by reading that file. 645 646 <p>In normal operation, the PicoLisp interpreter continuously executes an 647 infinite "read-eval-print loop". It reads one expression at a time, evaluates 648 it, and prints the result to the console. Any input into the system, like data 649 structures and function definitions, is done in a consistent way no matter 650 whether it is entered at the console or read from a file. 651 652 <p>Comments can be embedded in the input stream with the hash <code>#</code> 653 character. Everything up to the end of that line will be ignored by the reader. 654 655 <pre><code> 656 : (* 1 2 3) # This is a comment 657 -> 6 658 </code></pre> 659 660 <p>A comment spanning several lines may be enclosed between <code>#{</code> and 661 <code>}#</code>. 662 663 664 <p>Here is the I/O syntax for the individual PicoLisp data types (numbers, 665 symbols and lists) and for read-macros: 666 667 668 <p><hr> 669 <h4><a name="num-io">Numbers</a></h4> 670 671 <p>A number consists of an arbitrary number of digits ('<code>0</code>' through 672 '<code>9</code>'), optionally preceded by a sign character ('<code>+</code>' or 673 '<code>-</code>'). Legal number input is: 674 675 <pre><code> 676 : 7 677 -> 7 678 : -12345678901245678901234567890 679 -> -12345678901245678901234567890 680 </code></pre> 681 682 <p>Fixpoint numbers can be input by embedding a decimal point '<code>.</code>', 683 and setting the global variable <code><a href="refS.html#*Scl">*Scl</a></code> 684 appropriately: 685 686 <pre><code> 687 : *Scl 688 -> 0 689 690 : 123.45 691 -> 123 692 : 456.78 693 -> 457 694 695 : (setq *Scl 3) 696 -> 3 697 : 123.45 698 -> 123450 699 : 456.78 700 -> 456780 701 </code></pre> 702 703 <p>Thus, fixpoint input simply scales the number to an integer value 704 corresponding to the number of digits in <code><a 705 href="refS.html#*Scl">*Scl</a></code>. 706 707 <p>Formatted output of scaled fixpoint values can be done with the <code><a 708 href="refF.html#format">format</a></code> and <code><a 709 href="refR.html#round">round</a></code> functions: 710 711 <pre><code> 712 : (format 1234567890 2) 713 -> "12345678.90" 714 : (format 1234567890 2 "." ",") 715 -> "12,345,678.90" 716 </code></pre> 717 718 719 <p><hr> 720 <h4><a name="sym-io">Symbols</a></h4> 721 722 <p>The reader is able to recognize the individual symbol types from their 723 syntactic form. A symbol name should - of course - not look like a legal number 724 (see above). 725 726 <p>In general, symbol names are case-sensitive. <code>car</code> is not the same 727 as CAR. 728 729 730 <p><hr> 731 <h5><a name="nilSym-io">NIL</a></h5> 732 733 <p>Besides for standard normal form, <code>NIL</code> is also recognized as 734 <code>()</code>, <code>[]</code> or <code>""</code>. 735 736 <pre><code> 737 : NIL 738 -> NIL 739 : () 740 -> NIL 741 : "" 742 -> NIL 743 </code></pre> 744 745 <p>Output will always appear as <code>NIL</code>. 746 747 748 <p><hr> 749 <h5><a name="internal-io">Internal Symbols</a></h5> 750 751 <p>Internal symbol names can consist of any printable (non-whitespace) 752 character, except for the following meta characters: 753 754 <pre><code> 755 " ' ( ) , [ ] ` ~ { } 756 </code></pre> 757 758 <p>It is possible, though, to include these special characters into symbol names 759 by escaping them with a backslash '<code>\</code>'. 760 761 <p>The dot '<code>.</code>' has a dual nature. It is a meta character when 762 standing alone, denoting a <a href="#dotted">dotted pair</a>, but can otherwise 763 be used in symbol names. 764 765 <p>As a rule, anything not recognized by the reader as another data type will be 766 returned as an internal symbol. 767 768 769 <p><hr> 770 <h5><a name="transient-io">Transient Symbols</a></h5> 771 772 <p>A transient symbol is anything surrounded by double quotes '<code>"</code>'. 773 With that, it looks - and can be used - like a string constant in other 774 languages. However, it is a real symbol, and may be assigned a value or a 775 function definition, and properties. 776 777 <p>Initially, a transient symbol's value is that symbol itself, so that it does 778 not need to be quoted for evaluation: 779 780 <p><pre><code> 781 : "This is a string" 782 -> "This is a string" 783 </code></pre> 784 785 <p>However, care must be taken when assigning a value to a transient symbol. 786 This may cause unexpected behavior: 787 788 <p><pre><code> 789 : (setq "This is a string" 12345) 790 -> 12345 791 : "This is a string" 792 -> 12345 793 </code></pre> 794 795 <p>The name of a transient symbol can contain any character except the 796 null-byte. A double quote character can be escaped with a backslash 797 '<code>\</code>', and a backslash itself has to be escaped with another 798 backslash. Control characters can be written with a preceding hat 799 '<code>^</code>' character. 800 801 <p><pre><code> 802 : "We^Ird\\Str\"ing" 803 -> "We^Ird\\Str\"ing" 804 : (chop @) 805 -> ("W" "e" "^I" "r" "d" "\\" "S" "t" "r" "\"" "i" "n" "g") 806 </code></pre> 807 808 <p>A backslash '<code>\</code>' in a transient symbol name at the end of a line 809 discards the newline, and continues the name in the next line. In that case, all 810 leading spaces and tabs in that line are discarded, to allow proper source code 811 indentation. 812 813 <p><pre><code> 814 : "abc\ 815 def" 816 -> "abcdef" 817 </code></pre> 818 819 <p>The index for transient symbols is cleared automatically before and after 820 <code><a href="refL.html#load">load</a></code>ing a source file, or it can be 821 reset explicitly with the <code><a href="ref_.html#====">====</a></code> 822 function. With that mechanism, it is possible to create symbols with a local 823 access scope, not accessible from other parts of the program. 824 825 <p>A special case of transient symbols are <i>anonymous symbols</i>. These are 826 symbols without name (see <code><a href="refB.html#box">box</a></code>, <code><a 827 href="refB.html#box?">box?</a></code> or <code><a 828 href="refN.html#new">new</a></code>). They print as a dollar sign 829 (<code>$</code>) followed by a decimal digit string (actually their machine 830 address). 831 832 833 <p><hr> 834 <h5><a name="external-io">External Symbols</a></h5> 835 836 <p>External symbol names are surrounded by braces ('<code>{</code>' and 837 '<code>}</code>'). The characters of the symbol's name itself identify the 838 physical location of the external object. This is 839 840 <ul> 841 <li>in the 32-bit version: The number of the database file, and - separated by a 842 hyphen - the starting block in the database file. Both numbers are encoded in 843 base-64 notation (characters '<code>0</code>' through '<code>9</code>', 844 '<code>:</code>', '<code>;</code>', '<code>A</code>' through '<code>Z</code>' 845 and '<code>a</code>' through '<code>z</code>'). 846 847 <li>in the 64-bit version: The number of the database file minus 1 in "hax" 848 notation (i.e. hexadecimal/alpha notation, where '<code>@</code>' is zero, 849 '<code>A</code>' is 1 and '<code>O</code>' is 15 (from "alpha" to "omega")), 850 immediately followed (without a hyphen) the starting block in octal 851 ('<code>0</code>' through '<code>7</code>'). 852 853 </ul> 854 855 <p>In both cases, the database file (and possibly the hypen) are omitted for the 856 first (default) file. 857 858 <p><hr> 859 <h4><a name="lst-io">Lists</a></h4> 860 861 <p>Lists are surrounded by parentheses ('<code>(</code>' and '<code>)</code>'). 862 863 <p><code>(A)</code> is a list consisting of a single cell, with the symbol 864 <code>A</code> in its CAR, and <code>NIL</code> in its CDR. 865 866 <p><code>(A B C)</code> is a list consisting of three cells, with the symbols 867 <code>A</code>, <code>B</code> and <code>C</code> respectively in their CAR, and 868 <code>NIL</code> in the last cell's CDR. 869 870 <p><a name="dotted"><code>(A . B)</code></a> is a "dotted pair", a list 871 consisting of a single cell, with the symbol <code>A</code> in its CAR, and 872 <code>B</code> in its CDR. 873 874 <p>PicoLisp has built-in support for reading and printing simple circular lists. 875 If the dot in a dotted-pair notation is immediately followed by a closing 876 parenthesis, it indicates that the CDR of the last cell points back to the 877 beginning of that list. 878 879 <pre><code> 880 : (let L '(a b c) (conc L L)) 881 -> (a b c .) 882 : (cdr '(a b c .)) 883 -> (b c a .) 884 : (cddddr '(a b c .)) 885 -> (b c a .) 886 </code></pre> 887 888 <p>A similar result can be achieved with the function <code><a 889 href="refC.html#circ">circ</a></code>. Such lists must be used with care, 890 because many functions won't terminate or will crash when given such a list. 891 892 893 <p><hr> 894 <h4><a name="macro-io">Read-Macros</a></h4> 895 896 <p>Read-macros in PicoLisp are special forms that are recognized by the reader, 897 and modify its behavior. Note that they take effect immediately while <code><a 898 href="refR.html#read">read</a></code>ing an expression, and are not seen by the 899 <code>eval</code> in the main loop. 900 901 <p>The most prominent read-macro in Lisp is the single quote character 902 "<code>'</code>", which expands to a call of the <code><a 903 href="refQ.html#quote">quote</a></code> function. Note that the single quote 904 character is also printed instead of the full function name. 905 906 <pre><code> 907 : '(a b c) 908 -> (a b c) 909 : '(quote . a) 910 -> 'a 911 : (cons 'quote 'a) # (quote . a) 912 -> 'a 913 : (list 'quote 'a) # (quote a) 914 -> '(a) 915 </code></pre> 916 917 <p>A comma (<code>,</code>) will cause the reader to collect the following data 918 item into an <code><a href="refI.html#idx">idx</a></code> tree in the global 919 variable <code><a href="refU.html#*Uni">*Uni</a></code>, and to return a 920 previously inserted equal item if present. This makes it possible to create a 921 unique list of references to data which do normally not follow the rules of 922 pointer equality. If the value of <code>*Uni</code> is <code>T</code>, the 923 comma read macro mechanism is disabled. 924 925 <p>A single backquote character "<code>`</code>" will cause the reader to 926 evaluate the following expression, and return the result. 927 928 <pre><code> 929 : '(a `(+ 1 2 3) z) 930 -> (a 6 z) 931 </code></pre> 932 933 <p>A tilde character <code>~</code> inside a list will cause the reader to 934 evaluate the following expression, and (destructively) splice the result into 935 the list. 936 937 <pre><code> 938 : '(a b c ~(list 'd 'e 'f) g h i) 939 -> (a b c d e f g h i) 940 </code></pre> 941 942 <p>When a tilde character is used to separate two symbol names (without 943 surrounding whitespace), the first is taken as a namespace to look up the second 944 (64-bit version only). 945 946 <pre><code> 947 : 'libA~foo # Look up 'foo' in namespace 'libA' 948 -> "foo" # "foo" is not interned in the current namespace 949 </code></pre> 950 951 <p>Reading <code>libA~foo</code> is equivalent to switching the current 952 namespace to <code>libA</code> (with <code><a 953 href="refS.html#symbols">symbols</a></code>), reading the symbol 954 <code>foo</code>, and then switching back to the original namespace. 955 956 <p>Brackets ('<code>[</code>' and '<code>]</code>') can be used as super 957 parentheses. A closing bracket will match the innermost opening bracket, or all 958 currently open parentheses. 959 960 <pre><code> 961 : '(a (b (c (d] 962 -> (a (b (c (d)))) 963 : '(a (b [c (d])) 964 -> (a (b (c (d)))) 965 </code></pre> 966 967 <p>Finally, reading the sequence '<code>{}</code>' will result in a new 968 anonymous symbol with value <code>NIL</code>, equivalent to a call to <code><a 969 href="refB.html#box">box</a></code> without arguments. 970 971 <pre><code> 972 : '({} {} {}) 973 -> ($134599965 $134599967 $134599969) 974 : (mapcar val @) 975 -> (NIL NIL NIL) 976 </code></pre> 977 978 979 <p><hr> 980 <h3><a name="ev">Evaluation</a></h3> 981 982 <p>PicoLisp tries to evaluate any expression encountered in the read-eval-print 983 loop. Basically, it does so by applying the following three rules: 984 985 <p><ul> 986 <li>A number evaluates to itself. 987 988 <li>A symbol evaluates to its value (VAL). 989 990 <li>A list is evaluated as a function call, with the CAR as the function and the 991 CDR the arguments to that function. These arguments are in turn evaluated 992 according to these three rules. 993 994 </ul> 995 996 <pre><code> 997 : 1234 998 -> 1234 # Number evaluates to itself 999 : *Pid 1000 -> 22972 # Symbol evaluates to its VAL 1001 : (+ 1 2 3) 1002 -> 6 # List is evaluated as a function call 1003 </code></pre> 1004 1005 <p>For the third rule, however, things get a bit more involved. First - as a 1006 special case - if the CAR of the list is a number, the whole list is returned as 1007 it is: 1008 1009 <pre><code> 1010 : (1 2 3 4 5 6) 1011 -> (1 2 3 4 5 6) 1012 </code></pre> 1013 1014 <p>This is not really a function call but just a convenience to avoid having to 1015 quote simple data lists. 1016 1017 <p>Otherwise, if the CAR is a symbol or a list, PicoLisp tries to obtain an 1018 executable function from that, by either using the symbol's value, or by 1019 evaluating the list. 1020 1021 <p>What is an executable function? Or, said in another way, what can be applied 1022 to a list of arguments, to result in a function call? A legal function in 1023 PicoLisp is 1024 1025 <p><dl> 1026 <dt>either 1027 <dd>a <i>number</i>. When a number is used as a function, it is simply taken as 1028 a pointer to executable code that will be called with the list of (unevaluated) 1029 arguments as its single parameter. It is up to that code to evaluate the 1030 arguments, or not. Some functions do not evaluate their arguments (e.g. 1031 <code>quote</code>) or evaluate only some of their arguments (e.g. 1032 <code>setq</code>). 1033 1034 <dt>or 1035 <dd>a <i>lambda expression</i>. A lambda expression is a list, whose CAR is 1036 either a symbol or a list of symbols, and whose CDR is a list of expressions. 1037 Note: In contrast to other Lisp implementations, the symbol LAMBDA itself does 1038 not exist in PicoLisp but is implied from context. 1039 1040 </dl> 1041 1042 <p>A few examples should help to understand the practical consequences of these 1043 rules. In the most common case, the CAR will be a symbol defined as a function, 1044 like the <code>*</code> in: 1045 1046 <pre><code> 1047 : (* 1 2 3) # Call the function '*' 1048 -> 6 1049 </code></pre> 1050 1051 <p>Inspecting the VAL of <code>*</code> gives 1052 1053 <pre><code> 1054 : * # Get the VAL of the symbol '*' 1055 -> 67318096 1056 </code></pre> 1057 1058 <p>The VAL of <code>*</code> is a number. In fact, it is the numeric 1059 representation of a C-function pointer, i.e. a pointer to executable code. This 1060 is the case for all built-in functions of PicoLisp. 1061 1062 <p>Other functions in turn are written as Lisp expressions: 1063 1064 <pre><code> 1065 : (de foo (X Y) # Define the function 'foo' 1066 (* (+ X Y) (+ X Y)) ) 1067 -> foo 1068 : (foo 2 3) # Call the function 'foo' 1069 -> 25 1070 : foo # Get the VAL of the symbol 'foo' 1071 -> ((X Y) (* (+ X Y) (+ X Y))) 1072 </code></pre> 1073 1074 <p>The VAL of <code>foo</code> is a list. It is the list that was assigned to 1075 <code>foo</code> with the <code>de</code> function. It would be perfectly legal 1076 to use <code>setq</code> instead of <code>de</code>: 1077 1078 <pre><code> 1079 : (setq foo '((X Y) (* (+ X Y) (+ X Y)))) 1080 -> ((X Y) (* (+ X Y) (+ X Y))) 1081 : (foo 2 3) 1082 -> 25 1083 </code></pre> 1084 1085 <p>If the VAL of <code>foo</code> were another symbol, that symbol's VAL would 1086 be used instead to search for an executable function. 1087 1088 <p>As we said above, if the CAR of the evaluated expression is not a symbol but 1089 a list, that list is evaluated to obtain an executable function. 1090 1091 <pre><code> 1092 : ((intern (pack "c" "a" "r")) (1 2 3)) 1093 -> 1 1094 </code></pre> 1095 1096 <p>Here, the <code>intern</code> function returns the symbol <code>car</code> 1097 whose VAL is used then. It is also legal, though quite dangerous, to use the <a 1098 name="codePointer">code-pointer</a> directly: 1099 1100 <pre><code> 1101 : * 1102 -> 67318096 1103 : ((* 2 33659048) 1 2 3) 1104 -> 6 1105 : ((quote . 67318096) 1 2 3) 1106 -> 6 1107 : ((quote . 1234) (1 2 3)) 1108 Segmentation fault 1109 </code></pre> 1110 1111 <p>When an executable function is defined in Lisp itself, we call it a <a 1112 name="lambda"><i>lambda expression</i></a>. A lambda expression always has a 1113 list of executable expressions as its CDR. The CAR, however, must be a either a 1114 list of symbols, or a single symbol, and it controls the evaluation of the 1115 arguments to the executable function according to the following rules: 1116 1117 <p><dl> 1118 1119 <dt>When the CAR is a list of symbols 1120 <dd>For each of these symbols an argument is evaluated, then the symbols are 1121 bound simultaneously to the results. The body of the lambda expression is 1122 executed, then the VAL's of the symbols are restored to their original values. 1123 This is the most common case, a fixed number of arguments is passed to the 1124 function. 1125 1126 <dt>Otherwise, when the CAR is the symbol <code>@</code> 1127 <dd>All arguments are evaluated and the results kept internally in a list. The 1128 body of the lambda expression is executed, and the evaluated arguments can be 1129 accessed sequentially with the <code><a href="refA.html#args">args</a></code>, 1130 <code><a href="refN.html#next">next</a></code>, <code><a 1131 href="refA.html#arg">arg</a></code> and <code><a 1132 href="refR.html#rest">rest</a></code> functions. This allows to define functions 1133 with a variable number of evaluated arguments. 1134 1135 <dt>Otherwise, when the CAR is a single symbol 1136 <dd>The symbol is bound to the whole unevaluated argument list. The body of the 1137 lambda expression is executed, then the symbol is restored to its original 1138 value. This allows to define functions with unevaluated arguments. Any kind of 1139 interpretation and evaluation of the argument list can be done inside the 1140 expression body. 1141 1142 </dl> 1143 1144 <p>In all cases, the return value is the result of the last expression in the 1145 body. 1146 1147 <pre><code> 1148 : (de foo (X Y Z) # CAR is a list of symbols 1149 (list X Y Z) ) # Return a list of all arguments 1150 -> foo 1151 : (foo (+ 1 2) (+ 3 4) (+ 5 6)) 1152 -> (3 7 11) # all arguments are evaluated 1153 </code></pre> 1154 1155 <pre><code> 1156 : (de foo X # CAR is a single symbol 1157 X ) # Return the argument 1158 -> foo 1159 : (foo (+ 1 2) (+ 3 4) (+ 5 6)) 1160 -> ((+ 1 2) (+ 3 4) (+ 5 6)) # the whole unevaluated list is returned 1161 </code></pre> 1162 1163 <pre><code> 1164 : (de foo @ # CAR is the symbol '@' 1165 (list (next) (next) (next)) ) # Return the first three arguments 1166 -> foo 1167 : (foo (+ 1 2) (+ 3 4) (+ 5 6)) 1168 -> (3 7 11) # all arguments are evaluated 1169 </code></pre> 1170 1171 <p>Note that these forms can also be combined. For example, to evaluate only the 1172 first two arguments, bind the results to <code>X</code> and <code>Y</code>, and 1173 bind all other arguments (unevaluated) to <code>Z</code>: 1174 1175 <pre><code> 1176 : (de foo (X Y . Z) # CAR is a list with a dotted-pair tail 1177 (list X Y Z) ) # Return a list of all arguments 1178 -> foo 1179 : (foo (+ 1 2) (+ 3 4) (+ 5 6)) 1180 -> (3 7 ((+ 5 6))) # Only the first two arguments are evaluated 1181 </code></pre> 1182 1183 <p>Or, a single argument followed by a variable number of arguments: 1184 1185 <pre><code> 1186 : (de foo (X . @) # CAR is a dotted-pair with '@' 1187 (println X) # print the first evaluated argument 1188 (while (args) # while there are more arguments 1189 (println (next)) ) ) # print the next one 1190 -> foo 1191 : (foo (+ 1 2) (+ 3 4) (+ 5 6)) 1192 3 # X 1193 7 # next argument 1194 11 # and the last argument 1195 -> 11 1196 </code></pre> 1197 1198 <p>In general, if more than the expected number of arguments is supplied to a 1199 function, these extra arguments will be ignored. Missing arguments default to 1200 <code>NIL</code>. 1201 1202 1203 <p><hr> 1204 <h3><a name="coroutines">Coroutines</a></h3> 1205 1206 <p>Coroutines are independent execution contexts. They may have multiple entry 1207 and exit points, and preserve their environment between invocations. 1208 1209 <p>They are available only in the 64-bit version. 1210 1211 <p>A coroutine is identified by a tag. This tag can be passed to other 1212 functions, and (re)invoked as needed. In this regard coroutines are similar to 1213 "continuations" in other languages. 1214 1215 <p>When the tag goes out of scope while it is not actively running, the 1216 coroutine will be garabage collected. In cases where this is desired, using a <a 1217 href="#transient">transient</a> symbol for the tag is recommended. 1218 1219 <p>A coroutine is created by calling <code><a href="refC.html#co">co</a></code>. 1220 Its <code>prg</code> body will be executed, and unless <code><a 1221 href="refY.html#yield">yield</a></code> is called at some point, the coroutine 1222 will "fall off" at the end and disappear. 1223 1224 <p>When <code><a href="refY.html#yield">yield</a></code> is called, control is 1225 either transferred back to the caller, or to some other - explicitly specified, 1226 and already running - coroutine. 1227 1228 <p>A coroutine is stopped and disposed when 1229 1230 <p><ul> 1231 <li>execution falls off the end 1232 1233 <li>some other (co)routine calls <code><a href="refC.html#co">co</a></code> with 1234 that tag but without a <code>prg</code> body 1235 1236 <li>a <code><a href="refT.html#throw">throw</a></code> into another (co)routine 1237 environment is executed 1238 1239 <li>an error occurred, and <a href="#errors">error handling</a> was entered 1240 1241 </ul> 1242 1243 <p>Reentrant coroutines are not supported: A coroutine cannot resume itself 1244 directly or indirectly. 1245 1246 <p>Before using coroutines, make sure you have sufficient stack space, e.g. by 1247 calling 1248 1249 <pre><code> 1250 $ ulimit -s unlimited 1251 </code></pre> 1252 1253 <p>Without that, the stack limit in Linux is typically 8 MB. This gives only 1254 room - with a default coroutine <a href="refS.html#stack">stack</a> segment size 1255 of 1 MB - for the main segment (4 MB) plus four coroutines. 1256 1257 1258 <p><hr> 1259 <h3><a name="int">Interrupt</a></h3> 1260 1261 <p>During the evaluation of an expression, the PicoLisp interpreter can be 1262 interrupted at any time by hitting <code>Ctrl-C</code>. It will then enter the 1263 breakpoint routine, as if <code><a href="ref_.html#!">!</a></code> were called. 1264 1265 <p>Hitting ENTER at that point will continue evaluation, while <code>(<a 1266 href="refQ.html#quit">quit</a>)</code> will abort evaluation and return the 1267 interpreter to the top level. See also <code><a 1268 href="refD.html#debug">debug</a></code>, <code><a 1269 href="refE.html#e">e</a></code>, <code><a href="ref_.html#^">^</a></code> and 1270 <code><a href="refD.html#*Dbg">*Dbg</a></code> 1271 1272 <p>Other interrupts may be handled by <code><a 1273 href="refA.html#alarm">alarm</a></code>, <code><a 1274 href="refS.html#sigio">sigio</a></code>, <code><a 1275 href="refH.html#*Hup">*Hup</a></code> and <code><a 1276 href="refS.html#*Sig1">*Sig[12]</a></code>. 1277 1278 1279 <p><hr> 1280 <h3><a name="errors">Error Handling</a></h3> 1281 1282 <p>When a runtime error occurs, execution is stopped and an error handler is 1283 entered. 1284 1285 <p>The error handler resets the I/O channels to the console, and displays the 1286 location (if possible) and the reason of the error, followed by an error 1287 message. That message is also stored in the global <code><a 1288 href="refM.html#*Msg">*Msg</a></code>, and the location of the error in <code><a 1289 href="ref_.html#^">^</a></code>. If the VAL of the global <code><a 1290 href="refE.html#*Err">*Err</a></code> is non-<code>NIL</code> it is executed as 1291 a <code>prg</code> body. If the standard input is from a terminal, a 1292 read-eval-print loop (with a question mark "<code>?</code>" as prompt) is 1293 entered (the loop is exited when an empty line is input). Then all pending 1294 <code><a href="refF.html#finally">finally</a></code> expressions are executed, 1295 all variable bindings restored, and all files closed. If the standard input is 1296 not from a terminal, the interpreter terminates. Otherwise it is reset to its 1297 top-level state. 1298 1299 <pre><code> 1300 : (de foo (A B) (badFoo A B)) # 'foo' calls an undefined symbol 1301 -> foo 1302 : (foo 3 4) # Call 'foo' 1303 !? (badFoo A B) # Error handler entered 1304 badFoo -- Undefined 1305 ? A # Inspect 'A' 1306 -> 3 1307 ? B # Inspect 'B' 1308 -> 4 1309 ? # Empty line: Exit 1310 : 1311 </code></pre> 1312 1313 <p>Errors can be caught with <code><a href="refC.html#catch">catch</a></code>, 1314 if a list of substrings of possible error messages is supplied for the first 1315 argument. In such a case, the matching substring (or the whole error message if 1316 the substring is <code>NIL</code>) is returned. 1317 1318 <p>An arbitrary error can be thrown explicitly with <code><a 1319 href="refC.html#quit">quit</a></code>. 1320 1321 1322 <p><hr> 1323 <h3><a name="atres">@ Result</a></h3> 1324 1325 <p>In certain situations, the result of the last evaluation is stored in the VAL 1326 of the symbol <code>@</code>. This can be very convenient, because it often 1327 makes the assignment to temporary variables unnecessary. 1328 1329 <p>This happens in two - only superficially similar - situations: 1330 1331 <p><dl> 1332 1333 <dt><code><a href="refL.html#load">load</a></code> 1334 <dd>In read-eval loops, the last three results which were printed at the console 1335 are available in <code>@@@</code>, <code>@@</code> and <code>@</code>, in that 1336 order (i.e the latest result is in <code>@</code>). 1337 1338 <pre><code> 1339 : (+ 1 2 3) 1340 -> 6 1341 : (/ 128 4) 1342 -> 32 1343 : (- @ @@) # Subtract the last two results 1344 -> 26 1345 </code></pre> 1346 1347 <p><dt>Flow functions 1348 <dd>Flow- and logic-functions store the result of their controlling expression - 1349 respectively non-<code>NIL</code> results of their conditional expression - in 1350 <code>@</code>. 1351 1352 <pre><code> 1353 : (while (read) (println 'got: @)) 1354 abc # User input 1355 got: abc # print result 1356 123 # User input 1357 got: 123 # print result 1358 NIL 1359 -> 123 1360 1361 : (setq L (1 2 3 4 5 1 2 3 4 5)) 1362 -> (1 2 3 4 5 1 2 3 4 5) 1363 : (and (member 3 L) (member 3 (cdr @)) (set @ 999)) 1364 -> 999 1365 : L 1366 -> (1 2 3 4 5 1 2 999 4 5) 1367 </code></pre> 1368 1369 <p>Functions with controlling expressions are 1370 <a href="refC.html#case">case</a>, 1371 <a href="refC.html#casq">casq</a>, 1372 <a href="refP.html#prog1">prog1</a>, 1373 <a href="refP.html#prog2">prog2</a>, 1374 and the bodies of <code><a href="refR.html#*Run">*Run</a></code> tasks. 1375 1376 <p>Functions with conditional expressions are 1377 <a href="refA.html#and">and</a>, 1378 <a href="refC.html#cond">cond</a>, 1379 <a href="refD.html#do">do</a>, 1380 <a href="refF.html#for">for</a>, 1381 <a href="refI.html#if">if</a>, 1382 <a href="refI.html#if2">if2</a>, 1383 <a href="refI.html#ifn">ifn</a>, 1384 <a href="refL.html#loop">loop</a>, 1385 <a href="refN.html#nand">nand</a>, 1386 <a href="refN.html#nond">nond</a>, 1387 <a href="refN.html#nor">nor</a>, 1388 <a href="refN.html#not">not</a>, 1389 <a href="refO.html#or">or</a>, 1390 <a href="refS.html#state">state</a>, 1391 <a href="refU.html#unless">unless</a>, 1392 <a href="refU.html#until">until</a>, 1393 <a href="refW.html#when">when</a> and 1394 <a href="refW.html#while">while</a>. 1395 1396 </dl> 1397 1398 <p><code>@</code> is generally local to functions and methods, its value is 1399 automatically saved upon function entry and restored at exit. 1400 1401 1402 <p><hr> 1403 <h3><a name="cmp">Comparing</a></h3> 1404 1405 <p>In PicoLisp, it is legal to compare data items of arbitrary type. Any two 1406 items are either 1407 1408 <p><dl> 1409 1410 <dt>Identical 1411 <dd>They are the same memory object (pointer equality). For example, two 1412 internal symbols with the same name are identical. In the 64-bit version, also 1413 short numbers (up to 60 bits plus sign) are pointer-equal. 1414 1415 <dt>Equal 1416 <dd>They are equal in every respect (structure equality), but need not to be 1417 identical. Examples are numbers with the same value, transient symbols with the 1418 same name or lists with equal elements. 1419 1420 <dt>Or they have a well-defined ordinal relationship 1421 <dd>Numbers are comparable by their numeric value, strings by their name, and 1422 lists recursively by their elements (if the CAR's are equal, their CDR's are 1423 compared). For differing types, the following rule applies: Numbers are less 1424 than symbols, and symbols are less than lists. As special cases, 1425 <code>NIL</code> is always less than anything else, and <code>T</code> is always 1426 greater than anything else. 1427 1428 </dl> 1429 1430 <p>To demonstrate this, <code><a href="refS.html#sort">sort</a></code> a list of 1431 mixed data types: 1432 1433 <pre><code> 1434 : (sort '("abc" T (d e f) NIL 123 DEF)) 1435 -> (NIL 123 DEF "abc" (d e f) T) 1436 </code></pre> 1437 1438 <p>See also <code><a href="refM.html#max">max</a></code>, <code><a 1439 href="refM.html#min">min</a></code>, <code><a 1440 href="refR.html#rank">rank</a></code>, <code><a href="ref_.html#<"><</a></code>, 1441 <code><a href="ref_.html#=">=</a></code>, <code><a 1442 href="ref_.html#>">></a></code> etc. 1443 1444 1445 <p><hr> 1446 <h3><a name="oop">OO Concepts</a></h3> 1447 1448 <p>PicoLisp comes with built-in object oriented extensions. There seems to be a 1449 common agreement upon three criteria for object orientation: 1450 1451 <p><dl> 1452 <dt>Encapsulation 1453 <dd>Code and data are encapsulated into <u>objects</u>, giving them both a 1454 <u>behavior</u> and a <u>state</u>. Objects communicate by sending and receiving 1455 <u>messages</u>. 1456 1457 <dt>Inheritance 1458 <dd>Objects are organized into <u>classes</u>. The behavior of an object is 1459 inherited from its class(es) and superclass(es). 1460 1461 <dt>Polymorphism 1462 <dd>Objects of different classes may behave differently in response to the same 1463 message. For that, classes may define different methods for each message. 1464 1465 </dl> 1466 1467 <p>PicoLisp implements both objects and classes with symbols. Object-local data 1468 are stored in the symbol's property list, while the code (methods) and links to 1469 the superclasses are stored in the symbol's VAL (encapsulation). 1470 1471 <p>In fact, there is no formal difference between objects and classes (except 1472 that objects usually are anonymous symbols containing mostly local data, while 1473 classes are named internal symbols with an emphasis on method definitions). At 1474 any time, a class may be assigned its own local data (class variables), and any 1475 object can receive individual method definitions in addition to (or overriding) 1476 those inherited from its (super)classes. 1477 1478 <p>PicoLisp supports multiple inheritance. The VAL of each object is a (possibly 1479 empty) association list of message symbols and method bodies, concatenated with 1480 a list of classes. When a message is sent to an object, it is searched in the 1481 object's own method list, and then (with a left-to-right depth-first search) in 1482 the tree of its classes and superclasses. The first method found is executed and 1483 the search stops. The search may be explicitly continued with the <code><a 1484 href="refE.html#extra">extra</a></code> and <code><a 1485 href="refS.html#super">super</a></code> functions. 1486 1487 <p>Thus, which method is actually executed when a message is sent to an object 1488 depends on the classes that the object is currently linked to (polymorphism). As 1489 the method search is fully dynamic (late binding), an object's type (i.e. its 1490 classes and method definitions) can be changed even at runtime! 1491 1492 <p>While a method body is being executed, the global variable <code><a 1493 href="refT.html#This">This</a></code> is set to the current object, allowing 1494 the use of the short-cut property functions <code><a 1495 href="ref_.html#=:">=:</a></code>, <code><a href="ref_.html#:">:</a></code> 1496 and <code><a href="ref_.html#::">::</a></code>. 1497 1498 1499 <p><hr> 1500 <h3><a name="dbase">Database</a></h3> 1501 1502 <p>On the lowest level, a PicoLisp database is just a collection of <a 1503 href="#external">external symbols</a>. They reside in a database file, and are 1504 dynamically swapped in and out of memory. Only one database can be open at a 1505 time (<code><a href="refP.html#pool">pool</a></code>). 1506 1507 <p>In addition, further external symbols can be specified to originate from 1508 arbitrary sources via the <code><a href="refE.html#*Ext">*Ext</a></code> 1509 mechanism. 1510 1511 <p>Whenever an external symbol's value or property list is accessed, it will be 1512 automatically fetched into memory, and can then be used like any other symbol. 1513 Modifications will be written to disk only when <code><a 1514 href="refC.html#commit">commit</a></code> is called. Alternatively, all 1515 modifications since the last call to <code>commit</code> can be discarded by 1516 calling <code><a href="refR.html#rollback">rollback</a></code>. 1517 1518 <p><hr> 1519 <h4><a name="trans">Transactions</a></h4> 1520 1521 <p>In the typical case there will be multiple processes operating on the same 1522 database. These processes should be all children of the same parent process, 1523 which takes care of synchronizing read/write operations and heap contents. Then 1524 a database transaction is normally initiated by calling <code>(<a 1525 href="refD.html#dbSync">dbSync</a>)</code>, and closed by calling <code>(<a 1526 href="refC.html#commit">commit</a> 'upd)</code>. Short transactions, involving 1527 only a single DB operation, are available in functions like <code><a 1528 href="refN.html#new!">new!</a></code> and methods like <code><a 1529 href="refE.html#entityMesssages">put!></a></code> (by convention with an 1530 exclamation mark), which implicitly call <code>(dbSync)</code> and <code>(commit 1531 'upd)</code> themselves. 1532 1533 <p>A transaction proceeds through five phases: 1534 1535 <p><ol> 1536 <li><code><a href="refD.html#dbSync">dbSync</a></code> waits to get a <code><a 1537 href="refL.html#lock">lock</a></code> on the root object <code><a 1538 href="refD.html#*DB">*DB</a></code>. Other processes continue reading and 1539 writing meanwhile. 1540 1541 <li><code><a href="refD.html#dbSync">dbSync</a></code> calls <code><a 1542 href="refS.html#sync">sync</a></code> to synchronize with changes from other 1543 processes. We hold the shared lock, but other processes may continue reading. 1544 1545 <li>We make modifications to the internal state of external symbols with 1546 <code><a href="refE.html#entityMesssages">put>, set>, lose></a></code> etc. We - 1547 and also other processes - can still read the DB. 1548 1549 <li>We call <code>(<a href="refC.html#commit">commit</a> 'upd)</code>. 1550 <code>commit</code> obtains an exclusive lock (no more read operations by other 1551 processes), writes an optional transaction log, and then all modified symbols. 1552 As <code><a href="refU.html#upd">upd</a></code> is passed to 'commit', other 1553 processes synchronize with these changes. 1554 1555 <li>Finally, all locks are released by 'commit' 1556 1557 </ol> 1558 1559 <p><hr> 1560 <h4><a name="er">Entities / Relations</a></h4> 1561 1562 <p>The symbols in a database can be used to store arbitrary information 1563 structures. In typical use, some symbols represent nodes of search trees, by 1564 holding keys, values, and links to subtrees in their VAL's. Such a search tree 1565 in the database is called <u>index</u>. 1566 1567 <p>For the most part, other symbols in the database are objects derived from the 1568 <code><a href="refE.html#+Entity">+Entity</a></code> class. 1569 1570 <p>Entities depend on objects of the <code><a 1571 href="refR.html#+relation">+relation</a></code> class hierarchy. 1572 Relation-objects manage the property values of entities, they define the 1573 application database model and are responsible for the integrity of mutual 1574 object references and index trees. 1575 1576 <p>Relations are stored as properties in the entity classes, their methods are 1577 invoked as daemons whenever property values in an entity are changed. When 1578 defining an <code><a href="refE.html#+Entity">+Entity</a></code> class, relations are defined - in addition to 1579 the method definitions of a normal class - with the <code><a 1580 href="refR.html#rel">rel</a></code> function. Predefined relation classes 1581 include 1582 1583 <p><ul> 1584 <li>Primitive types like 1585 <dl> 1586 <dt><code><a href="refS.html#+Symbol">+Symbol</a></code> 1587 <dd>Symbolic data 1588 <dt><code><a href="refS.html#+String">+String</a></code> 1589 <dd>Strings (just a general case of symbols) 1590 <dt><code><a href="refN.html#+Number">+Number</a></code> 1591 <dd>Integers and fixpoint numbers 1592 <dt><code><a href="refD.html#+Date">+Date</a></code> 1593 <dd>Calendar date values, represented by a number 1594 <dt><code><a href="refT.html#+Time">+Time</a></code> 1595 <dd>Time-of-the-day values, represented by a number 1596 <dt><code><a href="refB.html#+Blob">+Blob</a></code> 1597 <dd>"Binary large objects" stored in separate files 1598 </dl> 1599 <li>Object-to-object relations 1600 <dl> 1601 <dt><code><a href="refL.html#+Link">+Link</a></code> 1602 <dd>A reference to some other entity 1603 <dt><code><a href="refH.html#+Hook">+Hook</a></code> 1604 <dd>A reference to an entity holding object-local index trees 1605 <dt><code><a href="refJ.html#+Joint">+Joint</a></code> 1606 <dd>A bidirectional reference to some other entity 1607 </dl> 1608 <li>Container prefix classes like 1609 <dl> 1610 <dt><code><a href="refL.html#+List">+List</a></code> 1611 <dd>A list of any of the other primitive or object relation types 1612 <dt><code><a href="refB.html#+Bag">+Bag</a></code> 1613 <dd>A list containing a mixture of any of the other types 1614 </dl> 1615 <li>Index prefix classes 1616 <dl> 1617 <dt><code><a href="refR.html#+Ref">+Ref</a></code> 1618 <dd>An index with other primitives or entities as key 1619 <dt><code><a href="refK.html#+Key">+Key</a></code> 1620 <dd>A unique index with other primitives or entities as key 1621 <dt><code><a href="refI.html#+Idx">+Idx</a></code> 1622 <dd>A full-text index, typically for strings 1623 <dt><code><a href="refS.html#+Sn">+Sn</a></code> 1624 <dd>Tolerant index, using a modified Soundex-Algorithm 1625 </dl> 1626 <li>Booleans 1627 <dl> 1628 <dt><code><a href="refB.html#+Bool">+Bool</a></code> 1629 <dd><code>T</code> or <code>NIL</code> 1630 </dl> 1631 <li>And a catch-all class 1632 <dl> 1633 <dt><code><a href="refA.html#+Any">+Any</a></code> 1634 <dd>Not specified, may be any of the above relations 1635 </dl> 1636 </ul> 1637 1638 1639 <p><hr> 1640 <h3><a name="pilog">Pilog (PicoLisp Prolog)</a></h3> 1641 1642 <p>A declarative language is built on top of PicoLisp, that has the semantics of 1643 Prolog, but uses the syntax of Lisp. 1644 1645 <p>For an explanation of Prolog's declarative programming style, an introduction 1646 like "Programming in Prolog" by Clocksin/Mellish (Springer-Verlag 1981) is 1647 recommended. 1648 1649 <p>Facts and rules can be declared with the <code><a 1650 href="refB.html#be">be</a></code> function. For example, a Prolog fact 1651 '<code>likes(john,mary).</code>' is written in Pilog as: 1652 1653 <pre><code> 1654 (be likes (John Mary)) 1655 </code></pre> 1656 1657 <p>and a rule '<code>likes(john,X) :- likes(X,wine), likes(X,food).</code>' is 1658 in Pilog: 1659 1660 <pre><code> 1661 (be likes (John @X) (likes @X wine) (likes @X food)) 1662 </code></pre> 1663 1664 <p>As in Prolog, the difference between facts and rules is that the latter ones 1665 have conditions, and usually contain variables. 1666 1667 <p>A variable in Pilog is any symbol starting with an at-mark character 1668 ("<code>@</code>"). The symbol <code>@</code> itself can be used as an anonymous 1669 variable: It will match during unification, but will not be bound to the matched 1670 values. 1671 1672 <p>The <i>cut</i> operator of Prolog (usually written as an exclamation mark 1673 (<code>!</code>)) is the symbol <code>T</code> in Pilog. 1674 1675 <p>An interactive query can be done with the <code><a 1676 href="ref_.html#?">?</a></code> function: 1677 1678 <pre><code> 1679 (? (likes John @X)) 1680 </code></pre> 1681 1682 <p>This will print all solutions, waiting for user input after each line. If a 1683 non-empty line (not just a ENTER key, but for example a dot (<code>.</code>) 1684 followed by ENTER) is typed, it will terminate. 1685 1686 <p>Pilog can be called from Lisp and vice versa: 1687 1688 <ul> 1689 1690 <li>The interface from Lisp is via the functions <code><a 1691 href="refG.html#goal">goal</a></code> (prepare a query from Lisp data) and 1692 <code><a href="refP.html#prove">prove</a></code> (return an association list of 1693 successful bindings), and the application level functions <code><a 1694 href="refP.html#pilog">pilog</a></code> and <code><a 1695 href="refS.html#solve">solve</a></code>. 1696 1697 <li>When the CAR of a Pilog clause is a Pilog variable, the CDR is executed as a 1698 Lisp expression and the result unified with that variable. 1699 1700 <li>Within such a Lisp expression in a Pilog clause, the current bindings of 1701 Pilog variables can be accessed with the <code><a 1702 href="ref_.html#->">-></a></code> function. 1703 1704 </ul> 1705 1706 <p><hr> 1707 <h3><a name="conv">Naming Conventions</a></h3> 1708 1709 <p>It was necessary to introduce - and adhere to - a set of conventions for 1710 PicoLisp symbol names. Because all (internal) symbols have a global scope (there 1711 are no packages or name spaces), and each symbol can only have either a value or 1712 function definition, it would otherwise be very easy to introduce name 1713 conflicts. Besides this, source code readability is increased when the scope of 1714 a symbol is indicated by its name. 1715 1716 <p>These conventions are not hard-coded into the language, but should be so into 1717 the head of the programmer. Here are the most commonly used ones: 1718 1719 <p><ul> 1720 <li>Global variables start with an asterisk "<code>*</code>" 1721 <li>Functions and other global symbols start with a lower case letter 1722 <li>Locally bound symbols start with an upper case letter 1723 <li>Local functions start with an underscore "<code>_</code>" 1724 <li>Classes start with a plus-sign "<code>+</code>", where the first letter 1725 <ul> 1726 <li>is in lower case for abstract classes 1727 <li>and in upper case for normal classes 1728 </ul> 1729 <li>Methods end with a right arrow "<code>></code>" 1730 <li>Class variables may be indicated by an upper case letter 1731 </ul> 1732 1733 <p>For historical reasons, the global constant symbols <code>T</code> and 1734 <code>NIL</code> do not obey these rules, and are written in upper case. 1735 1736 <p>For example, a local variable could easily overshadow a function definition: 1737 1738 <pre><code> 1739 : (de max-speed (car) 1740 (.. (get car 'speeds) ..) ) 1741 -> max-speed 1742 </code></pre> 1743 1744 <p>Inside the body of <code>max-speed</code> (and all other functions called 1745 during that execution) the kernel function <code>car</code> is redefined to some 1746 other value, and will surely crash if something like <code>(car Lst)</code> is 1747 executed. Instead, it is safe to write: 1748 1749 <pre><code> 1750 : (de max-speed (Car) # 'Car' with upper case first letter 1751 (.. (get Car 'speeds) ..) ) 1752 -> max-speed 1753 </code></pre> 1754 1755 <p>Note that there are also some strict naming rules (as opposed to the 1756 voluntary conventions) that are required by the corresponding kernel 1757 functionalities, like: 1758 1759 <p><ul> 1760 <li>Transient symbols are enclosed in double quotes (see <a 1761 href="#transient-io">Transient Symbols</a>) <li>External symbols are enclosed in 1762 braces (see <a href="#external-io">External Symbols</a>) <li>Pattern-Wildcards 1763 start with an at-mark "<code>@</code>" (see <a href="refM.html#match">match</a> 1764 and <a href="refF.html#fill">fill</a>) <li>Symbols referring to a shared library 1765 contain a colon "<code>lib:sym</code>" </ul> 1766 1767 <p>With that, the last of the above conventions (local functions start with an 1768 underscore) is not really necessary, because true local scope can be enforced 1769 with transient symbols. 1770 1771 1772 <p><hr> 1773 <h3><a name="trad">Breaking Traditions</a></h3> 1774 1775 <p>PicoLisp does not try very hard to be compatible with traditional Lisp 1776 systems. If you are used to some other Lisp dialects, you may notice the 1777 following differences: 1778 1779 <p><dl> 1780 1781 <dt>Case Sensitivity 1782 <dd>PicoLisp distinguishes between upper case and lower case characters in 1783 symbol names. Thus, <code>CAR</code> and <code>car</code> are different symbols, 1784 which was not the case in traditional Lisp systems. 1785 1786 <dt><code>QUOTE</code> 1787 <dd>In traditional Lisp, the <code>QUOTE</code> function returns its 1788 <i>first</i> unevaluated argument. In PicoLisp, on the other hand, 1789 <code>quote</code> returns <i>all</i> (unevaluated) argument(s). 1790 1791 <dt><code>LAMBDA</code> 1792 <dd>The <code>LAMBDA</code> function, in some way at the heart of traditional 1793 Lisp, is completely missing (and <code>quote</code> is used instead). 1794 1795 <dt><code>PROG</code> 1796 <dd>The <code>PROG</code> function of traditional Lisp, with its GOTO and ENTER 1797 functionality, is also missing. PicoLisp's <code>prog</code> function is just a 1798 simple sequencer (as <code>PROGN</code> in some Lisps). 1799 1800 <dt>Function/Value 1801 <dd>In PicoLisp, a symbol cannot have a value <i>and</i> a function definition 1802 at the same time. Though this is a disadvantage at first sight, it allows a 1803 completely uniform handling of functional data. 1804 1805 </dl> 1806 1807 1808 <p><hr> 1809 <h3><a name="bugs">Bugs</a></h3> 1810 1811 <p>The names of the symbols <code>T</code> and <code>NIL</code> violate the <a 1812 href="#conv">naming conventions</a>. They are global symbols, and should 1813 therefore start with an asterisk "<code>*</code>". It is too easy to bind them 1814 to some other value by mistake: 1815 1816 <pre><code> 1817 (de foo (R S T) 1818 ... 1819 </code></pre> 1820 1821 <p>However, <code><a href="refL.html#lint">lint</a></code> will issue a warning 1822 in such a case. 1823 1824 1825 <p><hr> 1826 <h2><a name="fun">Function Reference</a></h2> 1827 1828 <p>This section provides a reference manual for the kernel functions, and some 1829 extensions. See the thematically grouped list of indexes below. 1830 1831 <p>Though PicoLisp is a dynamically typed language (resolved at runtime, as 1832 opposed to statically (compile-time) typed languages), many functions can only 1833 accept and/or return a certain set of data types. For each function, the 1834 expected argument types and return values are described with the following 1835 abbreviations: 1836 1837 <p>The primary data types: 1838 1839 <p><ul> 1840 <li><code>num</code> - Number 1841 <li><code>sym</code> - Symbol 1842 <li><code>lst</code> - List 1843 </ul> 1844 1845 <p>Other (derived) data types 1846 1847 <p><ul> 1848 <li><code>any</code> - Anything: Any primary data type 1849 <li><code>flg</code> - Flag: Boolean value (<code>NIL</code> or non-<code>NIL</code>) 1850 <li><code>cnt</code> - A count or a small number 1851 <li><code>dat</code> - Date: Days, starting first of March of the year 0 A.D. 1852 <li><code>tim</code> - Time: Seconds since midnight 1853 <li><code>obj</code> - Object/Class: A symbol with methods and/or classes 1854 <li><code>var</code> - Variable: Either a symbol or a cons pair 1855 <li><code>exe</code> - Executable: A list as executable expression (<code>eval</code>) 1856 <li><code>prg</code> - Prog-Body: A list of executable expressions (<code>run</code>) 1857 <li><code>fun</code> - Function: Either a number (code-pointer), a symbol (message) or a list (lambda) 1858 <li><code>msg</code> - Message: A symbol sent to an object (to invoke a method) 1859 <li><code>cls</code> - Class: A symbol defined as an object's class 1860 <li><code>typ</code> - Type: A list of <code>cls</code> symbols 1861 <li><code>pat</code> - Pattern: A symbol whose name starts with an at-mark "<code>@</code>" 1862 <li><code>pid</code> - Process ID: A number, the ID of a Unix process 1863 <li><code>tree</code> - Database index tree specification 1864 <li><code>hook</code> - Database hook object 1865 </ul> 1866 1867 <p>Arguments evaluated by the function (depending on the context) are quoted 1868 (prefixed with the single quote character "<code>'</code>"). 1869 1870 <p> 1871 <a href="refA.html">A</a> 1872 <a href="refB.html">B</a> 1873 <a href="refC.html">C</a> 1874 <a href="refD.html">D</a> 1875 <a href="refE.html">E</a> 1876 <a href="refF.html">F</a> 1877 <a href="refG.html">G</a> 1878 <a href="refH.html">H</a> 1879 <a href="refI.html">I</a> 1880 <a href="refJ.html">J</a> 1881 <a href="refK.html">K</a> 1882 <a href="refL.html">L</a> 1883 <a href="refM.html">M</a> 1884 <a href="refN.html">N</a> 1885 <a href="refO.html">O</a> 1886 <a href="refP.html">P</a> 1887 <a href="refQ.html">Q</a> 1888 <a href="refR.html">R</a> 1889 <a href="refS.html">S</a> 1890 <a href="refT.html">T</a> 1891 <a href="refU.html">U</a> 1892 <a href="refV.html">V</a> 1893 <a href="refW.html">W</a> 1894 <a href="refX.html">X</a> 1895 <a href="refY.html">Y</a> 1896 <a href="refZ.html">Z</a> 1897 <a href="ref_.html">Other</a> 1898 1899 <p><span id="sortBtnHome"></span><dl> 1900 1901 <dt>Symbol Functions 1902 <dd><code> 1903 <a href="refN.html#new">new</a> 1904 <a href="refS.html#sym">sym</a> 1905 <a href="refS.html#str">str</a> 1906 <a href="refC.html#char">char</a> 1907 <a href="refN.html#name">name</a> 1908 <a href="refS.html#sp?">sp?</a> 1909 <a href="refP.html#pat?">pat?</a> 1910 <a href="refF.html#fun?">fun?</a> 1911 <a href="refA.html#all">all</a> 1912 <a href="refS.html#symbols">symbols</a> 1913 <a href="refL.html#local">local</a> 1914 <a href="refI.html#import">import</a> 1915 <a href="refI.html#intern">intern</a> 1916 <a href="refE.html#extern">extern</a> 1917 <a href="ref_.html#====">====</a> 1918 <a href="refQ.html#qsym">qsym</a> 1919 <a href="refL.html#loc">loc</a> 1920 <a href="refB.html#box?">box?</a> 1921 <a href="refS.html#str?">str?</a> 1922 <a href="refE.html#ext?">ext?</a> 1923 <a href="refT.html#touch">touch</a> 1924 <a href="refZ.html#zap">zap</a> 1925 <a href="refL.html#length">length</a> 1926 <a href="refS.html#size">size</a> 1927 <a href="refF.html#format">format</a> 1928 <a href="refC.html#chop">chop</a> 1929 <a href="refP.html#pack">pack</a> 1930 <a href="refG.html#glue">glue</a> 1931 <a href="refP.html#pad">pad</a> 1932 <a href="refA.html#align">align</a> 1933 <a href="refC.html#center">center</a> 1934 <a href="refT.html#text">text</a> 1935 <a href="refW.html#wrap">wrap</a> 1936 <a href="refP.html#pre?">pre?</a> 1937 <a href="refS.html#sub?">sub?</a> 1938 <a href="refL.html#low?">low?</a> 1939 <a href="refU.html#upp?">upp?</a> 1940 <a href="refL.html#lowc">lowc</a> 1941 <a href="refU.html#uppc">uppc</a> 1942 <a href="refF.html#fold">fold</a> 1943 <a href="refV.html#val">val</a> 1944 <a href="refG.html#getd">getd</a> 1945 <a href="refS.html#set">set</a> 1946 <a href="refS.html#setq">setq</a> 1947 <a href="refD.html#def">def</a> 1948 <a href="refD.html#de">de</a> 1949 <a href="refD.html#dm">dm</a> 1950 <a href="refR.html#recur">recur</a> 1951 <a href="refU.html#undef">undef</a> 1952 <a href="refR.html#redef">redef</a> 1953 <a href="refD.html#daemon">daemon</a> 1954 <a href="refP.html#patch">patch</a> 1955 <a href="refX.html#xchg">xchg</a> 1956 <a href="refO.html#on">on</a> 1957 <a href="refO.html#off">off</a> 1958 <a href="refO.html#onOff">onOff</a> 1959 <a href="refZ.html#zero">zero</a> 1960 <a href="refO.html#one">one</a> 1961 <a href="refD.html#default">default</a> 1962 <a href="refE.html#expr">expr</a> 1963 <a href="refS.html#subr">subr</a> 1964 <a href="refL.html#let">let</a> 1965 <a href="refL.html#let?">let?</a> 1966 <a href="refU.html#use">use</a> 1967 <a href="refA.html#accu">accu</a> 1968 <a href="refP.html#push">push</a> 1969 <a href="refP.html#push1">push1</a> 1970 <a href="refP.html#pop">pop</a> 1971 <a href="refC.html#cut">cut</a> 1972 <a href="refD.html#del">del</a> 1973 <a href="refQ.html#queue">queue</a> 1974 <a href="refF.html#fifo">fifo</a> 1975 <a href="refI.html#idx">idx</a> 1976 <a href="refL.html#lup">lup</a> 1977 <a href="refC.html#cache">cache</a> 1978 <a href="refL.html#locale">locale</a> 1979 <a href="refD.html#dirname">dirname</a> 1980 </code> 1981 1982 <dt>Property Access 1983 <dd><code> 1984 <a href="refP.html#put">put</a> 1985 <a href="refG.html#get">get</a> 1986 <a href="refP.html#prop">prop</a> 1987 <a href="ref_.html#;">;</a> 1988 <a href="ref_.html#=:">=:</a> 1989 <a href="ref_.html#:">:</a> 1990 <a href="ref_.html#::">::</a> 1991 <a href="refP.html#putl">putl</a> 1992 <a href="refG.html#getl">getl</a> 1993 <a href="refW.html#wipe">wipe</a> 1994 <a href="refM.html#meta">meta</a> 1995 </code> 1996 1997 <dt>Predicates 1998 <dd><code> 1999 <a href="refA.html#atom">atom</a> 2000 <a href="refP.html#pair">pair</a> 2001 <a href="refC.html#circ?">circ?</a> 2002 <a href="refL.html#lst?">lst?</a> 2003 <a href="refN.html#num?">num?</a> 2004 <a href="refS.html#sym?">sym?</a> 2005 <a href="refF.html#flg?">flg?</a> 2006 <a href="refS.html#sp?">sp?</a> 2007 <a href="refP.html#pat?">pat?</a> 2008 <a href="refF.html#fun?">fun?</a> 2009 <a href="refB.html#box?">box?</a> 2010 <a href="refS.html#str?">str?</a> 2011 <a href="refE.html#ext?">ext?</a> 2012 <a href="refB.html#bool">bool</a> 2013 <a href="refN.html#not">not</a> 2014 <a href="ref_.html#==">==</a> 2015 <a href="refN.html#n==">n==</a> 2016 <a href="ref_.html#=">=</a> 2017 <a href="ref_.html#<>"><></a> 2018 <a href="ref_.html#=0">=0</a> 2019 <a href="ref_.html#=T">=T</a> 2020 <a href="refN.html#n0">n0</a> 2021 <a href="refN.html#nT">nT</a> 2022 <a href="ref_.html#<"><</a> 2023 <a href="ref_.html#<="><=</a> 2024 <a href="ref_.html#>">></a> 2025 <a href="ref_.html#>=">>=</a> 2026 <a href="refM.html#match">match</a> 2027 </code> 2028 2029 <dt>Arithmetics 2030 <dd><code> 2031 <a href="ref_.html#+">+</a> 2032 <a href="ref_.html#-">-</a> 2033 <a href="ref_.html#*">*</a> 2034 <a href="ref_.html#/">/</a> 2035 <a href="ref_.html#%">%</a> 2036 <a href="ref_.html#*/">*/</a> 2037 <a href="ref_.html#**">**</a> 2038 <a href="refI.html#inc">inc</a> 2039 <a href="refD.html#dec">dec</a> 2040 <a href="ref_.html#>>">>></a> 2041 <a href="refL.html#lt0">lt0</a> 2042 <a href="refL.html#le0">le0</a> 2043 <a href="refG.html#ge0">ge0</a> 2044 <a href="refG.html#gt0">gt0</a> 2045 <a href="refA.html#abs">abs</a> 2046 <a href="refB.html#bit?">bit?</a> 2047 <a href="ref_.html#&">&</a> 2048 <a href="ref_.html#|">|</a> 2049 <a href="refX.html#x|">x|</a> 2050 <a href="refS.html#sqrt">sqrt</a> 2051 <a href="refS.html#seed">seed</a> 2052 <a href="refR.html#rand">rand</a> 2053 <a href="refM.html#max">max</a> 2054 <a href="refM.html#min">min</a> 2055 <a href="refL.html#length">length</a> 2056 <a href="refS.html#size">size</a> 2057 <a href="refA.html#accu">accu</a> 2058 <a href="refF.html#format">format</a> 2059 <a href="refP.html#pad">pad</a> 2060 <a href="refM.html#money">money</a> 2061 <a href="refR.html#round">round</a> 2062 <a href="refB.html#bin">bin</a> 2063 <a href="refO.html#oct">oct</a> 2064 <a href="refH.html#hex">hex</a> 2065 <a href="refH.html#hax">hax</a> 2066 <a href="refF.html#fmt64">fmt64</a> 2067 </code> 2068 2069 <dt>List Processing 2070 <dd><code> 2071 <a href="refC.html#car">car</a> 2072 <a href="refC.html#cdr">cdr</a> 2073 <a href="refC.html#caar">caar</a> 2074 <a href="refC.html#cadr">cadr</a> 2075 <a href="refC.html#cdar">cdar</a> 2076 <a href="refC.html#cddr">cddr</a> 2077 <a href="refC.html#caaar">caaar</a> 2078 <a href="refC.html#caadr">caadr</a> 2079 <a href="refC.html#cadar">cadar</a> 2080 <a href="refC.html#caddr">caddr</a> 2081 <a href="refC.html#cdaar">cdaar</a> 2082 <a href="refC.html#cdadr">cdadr</a> 2083 <a href="refC.html#cddar">cddar</a> 2084 <a href="refC.html#cdddr">cdddr</a> 2085 <a href="refC.html#cadddr">cadddr</a> 2086 <a href="refC.html#cddddr">cddddr</a> 2087 <a href="refN.html#nth">nth</a> 2088 <a href="refC.html#con">con</a> 2089 <a href="refC.html#cons">cons</a> 2090 <a href="refC.html#conc">conc</a> 2091 <a href="refC.html#circ">circ</a> 2092 <a href="refR.html#rot">rot</a> 2093 <a href="refL.html#list">list</a> 2094 <a href="refN.html#need">need</a> 2095 <a href="refR.html#range">range</a> 2096 <a href="refF.html#full">full</a> 2097 <a href="refM.html#make">make</a> 2098 <a href="refM.html#made">made</a> 2099 <a href="refC.html#chain">chain</a> 2100 <a href="refL.html#link">link</a> 2101 <a href="refY.html#yoke">yoke</a> 2102 <a href="refC.html#copy">copy</a> 2103 <a href="refM.html#mix">mix</a> 2104 <a href="refA.html#append">append</a> 2105 <a href="refD.html#delete">delete</a> 2106 <a href="refD.html#delq">delq</a> 2107 <a href="refR.html#replace">replace</a> 2108 <a href="refI.html#insert">insert</a> 2109 <a href="refR.html#remove">remove</a> 2110 <a href="refP.html#place">place</a> 2111 <a href="refS.html#strip">strip</a> 2112 <a href="refS.html#split">split</a> 2113 <a href="refR.html#reverse">reverse</a> 2114 <a href="refF.html#flip">flip</a> 2115 <a href="refT.html#trim">trim</a> 2116 <a href="refC.html#clip">clip</a> 2117 <a href="refH.html#head">head</a> 2118 <a href="refT.html#tail">tail</a> 2119 <a href="refS.html#stem">stem</a> 2120 <a href="refF.html#fin">fin</a> 2121 <a href="refL.html#last">last</a> 2122 <a href="refM.html#member">member</a> 2123 <a href="refM.html#memq">memq</a> 2124 <a href="refM.html#mmeq">mmeq</a> 2125 <a href="refS.html#sect">sect</a> 2126 <a href="refD.html#diff">diff</a> 2127 <a href="refI.html#index">index</a> 2128 <a href="refO.html#offset">offset</a> 2129 <a href="refP.html#prior">prior</a> 2130 <a href="refA.html#assoc">assoc</a> 2131 <a href="refA.html#asoq">asoq</a> 2132 <a href="refR.html#rank">rank</a> 2133 <a href="refS.html#sort">sort</a> 2134 <a href="refU.html#uniq">uniq</a> 2135 <a href="refG.html#group">group</a> 2136 <a href="refL.html#length">length</a> 2137 <a href="refS.html#size">size</a> 2138 <a href="refB.html#bytes">bytes</a> 2139 <a href="refV.html#val">val</a> 2140 <a href="refS.html#set">set</a> 2141 <a href="refX.html#xchg">xchg</a> 2142 <a href="refP.html#push">push</a> 2143 <a href="refP.html#push1">push1</a> 2144 <a href="refP.html#pop">pop</a> 2145 <a href="refC.html#cut">cut</a> 2146 <a href="refQ.html#queue">queue</a> 2147 <a href="refF.html#fifo">fifo</a> 2148 <a href="refI.html#idx">idx</a> 2149 <a href="refB.html#balance">balance</a> 2150 <a href="refG.html#get">get</a> 2151 <a href="refF.html#fill">fill</a> 2152 <a href="refA.html#apply">apply</a> 2153 </code> 2154 2155 <dt>Control Flow 2156 <dd><code> 2157 <a href="refL.html#load">load</a> 2158 <a href="refA.html#args">args</a> 2159 <a href="refN.html#next">next</a> 2160 <a href="refA.html#arg">arg</a> 2161 <a href="refR.html#rest">rest</a> 2162 <a href="refP.html#pass">pass</a> 2163 <a href="refQ.html#quote">quote</a> 2164 <a href="refA.html#as">as</a> 2165 <a href="refL.html#lit">lit</a> 2166 <a href="refE.html#eval">eval</a> 2167 <a href="refR.html#run">run</a> 2168 <a href="refM.html#macro">macro</a> 2169 <a href="refC.html#curry">curry</a> 2170 <a href="refD.html#def">def</a> 2171 <a href="refD.html#de">de</a> 2172 <a href="refD.html#dm">dm</a> 2173 <a href="refR.html#recur">recur</a> 2174 <a href="refR.html#recurse">recurse</a> 2175 <a href="refU.html#undef">undef</a> 2176 <a href="refB.html#box">box</a> 2177 <a href="refN.html#new">new</a> 2178 <a href="refT.html#type">type</a> 2179 <a href="refI.html#isa">isa</a> 2180 <a href="refM.html#method">method</a> 2181 <a href="refM.html#meth">meth</a> 2182 <a href="refS.html#send">send</a> 2183 <a href="refT.html#try">try</a> 2184 <a href="refS.html#super">super</a> 2185 <a href="refE.html#extra">extra</a> 2186 <a href="refW.html#with">with</a> 2187 <a href="refB.html#bind">bind</a> 2188 <a href="refJ.html#job">job</a> 2189 <a href="refL.html#let">let</a> 2190 <a href="refL.html#let?">let?</a> 2191 <a href="refU.html#use">use</a> 2192 <a href="refA.html#and">and</a> 2193 <a href="refO.html#or">or</a> 2194 <a href="refN.html#nand">nand</a> 2195 <a href="refN.html#nor">nor</a> 2196 <a href="refX.html#xor">xor</a> 2197 <a href="refB.html#bool">bool</a> 2198 <a href="refN.html#not">not</a> 2199 <a href="refN.html#nil">nil</a> 2200 <a href="refT.html#t">t</a> 2201 <a href="refP.html#prog">prog</a> 2202 <a href="refP.html#prog1">prog1</a> 2203 <a href="refP.html#prog2">prog2</a> 2204 <a href="refI.html#if">if</a> 2205 <a href="refI.html#if2">if2</a> 2206 <a href="refI.html#ifn">ifn</a> 2207 <a href="refW.html#when">when</a> 2208 <a href="refU.html#unless">unless</a> 2209 <a href="refC.html#cond">cond</a> 2210 <a href="refN.html#nond">nond</a> 2211 <a href="refC.html#case">case</a> 2212 <a href="refC.html#casq">casq</a> 2213 <a href="refS.html#state">state</a> 2214 <a href="refW.html#while">while</a> 2215 <a href="refU.html#until">until</a> 2216 <a href="refL.html#loop">loop</a> 2217 <a href="refD.html#do">do</a> 2218 <a href="refA.html#at">at</a> 2219 <a href="refF.html#for">for</a> 2220 <a href="refC.html#catch">catch</a> 2221 <a href="refT.html#throw">throw</a> 2222 <a href="refF.html#finally">finally</a> 2223 <a href="refC.html#co">co</a> 2224 <a href="refY.html#yield">yield</a> 2225 <a href="ref_.html#!">!</a> 2226 <a href="refE.html#e">e</a> 2227 <a href="ref_.html#$">$</a> 2228 <a href="refC.html#call">call</a> 2229 <a href="refT.html#tick">tick</a> 2230 <a href="refI.html#ipid">ipid</a> 2231 <a href="refO.html#opid">opid</a> 2232 <a href="refK.html#kill">kill</a> 2233 <a href="refQ.html#quit">quit</a> 2234 <a href="refT.html#task">task</a> 2235 <a href="refF.html#fork">fork</a> 2236 <a href="refP.html#pipe">pipe</a> 2237 <a href="refL.html#later">later</a> 2238 <a href="refT.html#timeout">timeout</a> 2239 <a href="refA.html#abort">abort</a> 2240 <a href="refB.html#bye">bye</a> 2241 </code> 2242 2243 <dt>Mapping 2244 <dd><code> 2245 <a href="refA.html#apply">apply</a> 2246 <a href="refP.html#pass">pass</a> 2247 <a href="refM.html#maps">maps</a> 2248 <a href="refM.html#map">map</a> 2249 <a href="refM.html#mapc">mapc</a> 2250 <a href="refM.html#maplist">maplist</a> 2251 <a href="refM.html#mapcar">mapcar</a> 2252 <a href="refM.html#mapcon">mapcon</a> 2253 <a href="refM.html#mapcan">mapcan</a> 2254 <a href="refF.html#filter">filter</a> 2255 <a href="refE.html#extract">extract</a> 2256 <a href="refS.html#seek">seek</a> 2257 <a href="refF.html#find">find</a> 2258 <a href="refP.html#pick">pick</a> 2259 <a href="refC.html#cnt">cnt</a> 2260 <a href="refS.html#sum">sum</a> 2261 <a href="refM.html#maxi">maxi</a> 2262 <a href="refM.html#mini">mini</a> 2263 <a href="refF.html#fish">fish</a> 2264 <a href="refB.html#by">by</a> 2265 </code> 2266 2267 <dt>Input/Output 2268 <dd><code> 2269 <a href="refP.html#path">path</a> 2270 <a href="refI.html#in">in</a> 2271 <a href="refO.html#out">out</a> 2272 <a href="refE.html#err">err</a> 2273 <a href="refC.html#ctl">ctl</a> 2274 <a href="refI.html#ipid">ipid</a> 2275 <a href="refO.html#opid">opid</a> 2276 <a href="refP.html#pipe">pipe</a> 2277 <a href="refA.html#any">any</a> 2278 <a href="refS.html#sym">sym</a> 2279 <a href="refS.html#str">str</a> 2280 <a href="refL.html#load">load</a> 2281 <a href="refH.html#hear">hear</a> 2282 <a href="refT.html#tell">tell</a> 2283 <a href="refK.html#key">key</a> 2284 <a href="refP.html#poll">poll</a> 2285 <a href="refP.html#peek">peek</a> 2286 <a href="refC.html#char">char</a> 2287 <a href="refS.html#skip">skip</a> 2288 <a href="refE.html#eol">eol</a> 2289 <a href="refE.html#eof">eof</a> 2290 <a href="refF.html#from">from</a> 2291 <a href="refT.html#till">till</a> 2292 <a href="refL.html#line">line</a> 2293 <a href="refF.html#format">format</a> 2294 <a href="refS.html#scl">scl</a> 2295 <a href="refR.html#read">read</a> 2296 <a href="refP.html#print">print</a> 2297 <a href="refP.html#println">println</a> 2298 <a href="refP.html#printsp">printsp</a> 2299 <a href="refP.html#prin">prin</a> 2300 <a href="refP.html#prinl">prinl</a> 2301 <a href="refM.html#msg">msg</a> 2302 <a href="refS.html#space">space</a> 2303 <a href="refB.html#beep">beep</a> 2304 <a href="refT.html#tab">tab</a> 2305 <a href="refF.html#flush">flush</a> 2306 <a href="refR.html#rewind">rewind</a> 2307 <a href="refR.html#rd">rd</a> 2308 <a href="refP.html#pr">pr</a> 2309 <a href="refW.html#wr">wr</a> 2310 <a href="refW.html#wait">wait</a> 2311 <a href="refS.html#sync">sync</a> 2312 <a href="refE.html#echo">echo</a> 2313 <a href="refI.html#info">info</a> 2314 <a href="refF.html#file">file</a> 2315 <a href="refD.html#dir">dir</a> 2316 <a href="refL.html#lines">lines</a> 2317 <a href="refO.html#open">open</a> 2318 <a href="refC.html#close">close</a> 2319 <a href="refP.html#port">port</a> 2320 <a href="refL.html#listen">listen</a> 2321 <a href="refA.html#accept">accept</a> 2322 <a href="refH.html#host">host</a> 2323 <a href="refC.html#connect">connect</a> 2324 <a href="refU.html#udp">udp</a> 2325 <a href="refS.html#script">script</a> 2326 <a href="refO.html#once">once</a> 2327 <a href="refR.html#rc">rc</a> 2328 <a href="refA.html#acquire">acquire</a> 2329 <a href="refR.html#release">release</a> 2330 <a href="refP.html#pretty">pretty</a> 2331 <a href="refP.html#pp">pp</a> 2332 <a href="refS.html#show">show</a> 2333 <a href="refV.html#view">view</a> 2334 <a href="refH.html#here">here</a> 2335 <a href="refP.html#prEval">prEval</a> 2336 <a href="refM.html#mail">mail</a> 2337 </code> 2338 2339 <dt>Object Orientation 2340 <dd><code> 2341 <a href="refC.html#*Class">*Class</a> 2342 <a href="refC.html#class">class</a> 2343 <a href="refD.html#dm">dm</a> 2344 <a href="refR.html#rel">rel</a> 2345 <a href="refV.html#var">var</a> 2346 <a href="refV.html#var:">var:</a> 2347 <a href="refN.html#new">new</a> 2348 <a href="refT.html#type">type</a> 2349 <a href="refI.html#isa">isa</a> 2350 <a href="refM.html#method">method</a> 2351 <a href="refM.html#meth">meth</a> 2352 <a href="refS.html#send">send</a> 2353 <a href="refT.html#try">try</a> 2354 <a href="refO.html#object">object</a> 2355 <a href="refE.html#extend">extend</a> 2356 <a href="refS.html#super">super</a> 2357 <a href="refE.html#extra">extra</a> 2358 <a href="refW.html#with">with</a> 2359 <a href="refT.html#This">This</a> 2360 <a href="refC.html#can">can</a> 2361 <a href="refD.html#dep">dep</a> 2362 </code> 2363 2364 <dt>Database 2365 <dd><code> 2366 <a href="refP.html#pool">pool</a> 2367 <a href="refJ.html#journal">journal</a> 2368 <a href="refI.html#id">id</a> 2369 <a href="refS.html#seq">seq</a> 2370 <a href="refL.html#lieu">lieu</a> 2371 <a href="refL.html#lock">lock</a> 2372 <a href="refC.html#commit">commit</a> 2373 <a href="refR.html#rollback">rollback</a> 2374 <a href="refM.html#mark">mark</a> 2375 <a href="refF.html#free">free</a> 2376 <a href="refD.html#dbck">dbck</a> 2377 <a href="refD.html#dbs">dbs</a> 2378 <a href="refD.html#dbs+">dbs+</a> 2379 <a href="refD.html#db:">db:</a> 2380 <a href="refT.html#tree">tree</a> 2381 <a href="refD.html#db">db</a> 2382 <a href="refA.html#aux">aux</a> 2383 <a href="refC.html#collect">collect</a> 2384 <a href="refG.html#genKey">genKey</a> 2385 <a href="refU.html#useKey">useKey</a> 2386 <a href="refR.html#+relation">+relation</a> 2387 <a href="refA.html#+Any">+Any</a> 2388 <a href="refB.html#+Bag">+Bag</a> 2389 <a href="refB.html#+Bool">+Bool</a> 2390 <a href="refN.html#+Number">+Number</a> 2391 <a href="refD.html#+Date">+Date</a> 2392 <a href="refT.html#+Time">+Time</a> 2393 <a href="refS.html#+Symbol">+Symbol</a> 2394 <a href="refS.html#+String">+String</a> 2395 <a href="refL.html#+Link">+Link</a> 2396 <a href="refJ.html#+Joint">+Joint</a> 2397 <a href="refB.html#+Blob">+Blob</a> 2398 <a href="refH.html#+Hook">+Hook</a> 2399 <a href="refH.html#+Hook2">+Hook2</a> 2400 <a href="refI.html#+index">+index</a> 2401 <a href="refK.html#+Key">+Key</a> 2402 <a href="refR.html#+Ref">+Ref</a> 2403 <a href="refR.html#+Ref2">+Ref2</a> 2404 <a href="refI.html#+Idx">+Idx</a> 2405 <a href="refS.html#+Sn">+Sn</a> 2406 <a href="refF.html#+Fold">+Fold</a> 2407 <a href="refI.html#+IdxFold">+IdxFold</a> 2408 <a href="refA.html#+Aux">+Aux</a> 2409 <a href="refU.html#+UB">+UB</a> 2410 <a href="refD.html#+Dep">+Dep</a> 2411 <a href="refL.html#+List">+List</a> 2412 <a href="refN.html#+Need">+Need</a> 2413 <a href="refM.html#+Mis">+Mis</a> 2414 <a href="refA.html#+Alt">+Alt</a> 2415 <a href="refS.html#+Swap">+Swap</a> 2416 <a href="refE.html#+Entity">+Entity</a> 2417 <a href="refB.html#blob">blob</a> 2418 <a href="refD.html#dbSync">dbSync</a> 2419 <a href="refN.html#new!">new!</a> 2420 <a href="refS.html#set!">set!</a> 2421 <a href="refP.html#put!">put!</a> 2422 <a href="refI.html#inc!">inc!</a> 2423 <a href="refB.html#blob!">blob!</a> 2424 <a href="refU.html#upd">upd</a> 2425 <a href="refR.html#rel">rel</a> 2426 <a href="refR.html#request">request</a> 2427 <a href="refO.html#obj">obj</a> 2428 <a href="refF.html#fmt64">fmt64</a> 2429 <a href="refR.html#root">root</a> 2430 <a href="refF.html#fetch">fetch</a> 2431 <a href="refS.html#store">store</a> 2432 <a href="refC.html#count">count</a> 2433 <a href="refL.html#leaf">leaf</a> 2434 <a href="refM.html#minKey">minKey</a> 2435 <a href="refM.html#maxKey">maxKey</a> 2436 <a href="refI.html#init">init</a> 2437 <a href="refS.html#step">step</a> 2438 <a href="refS.html#scan">scan</a> 2439 <a href="refI.html#iter">iter</a> 2440 <a href="refP.html#prune">prune</a> 2441 <a href="refZ.html#zapTree">zapTree</a> 2442 <a href="refC.html#chkTree">chkTree</a> 2443 <a href="refD.html#db/3">db/3</a> 2444 <a href="refD.html#db/4">db/4</a> 2445 <a href="refD.html#db/5">db/5</a> 2446 <a href="refV.html#val/3">val/3</a> 2447 <a href="refL.html#lst/3">lst/3</a> 2448 <a href="refM.html#map/3">map/3</a> 2449 <a href="refI.html#isa/2">isa/2</a> 2450 <a href="refS.html#same/3">same/3</a> 2451 <a href="refB.html#bool/3">bool/3</a> 2452 <a href="refR.html#range/3">range/3</a> 2453 <a href="refH.html#head/3">head/3</a> 2454 <a href="refF.html#fold/3">fold/3</a> 2455 <a href="refP.html#part/3">part/3</a> 2456 <a href="refT.html#tolr/3">tolr/3</a> 2457 <a href="refS.html#select/3">select/3</a> 2458 <a href="refR.html#remote/2">remote/2</a> 2459 </code> 2460 2461 <dt>Pilog 2462 <dd><code> 2463 <a href="refP.html#prove">prove</a> 2464 <a href="ref_.html#->">-></a> 2465 <a href="refU.html#unify">unify</a> 2466 <a href="refB.html#be">be</a> 2467 <a href="refC.html#clause">clause</a> 2468 <a href="refR.html#repeat">repeat</a> 2469 <a href="refA.html#asserta">asserta</a> 2470 <a href="refA.html#assertz">assertz</a> 2471 <a href="refR.html#retract">retract</a> 2472 <a href="refR.html#rules">rules</a> 2473 <a href="refG.html#goal">goal</a> 2474 <a href="refF.html#fail">fail</a> 2475 <a href="refP.html#pilog">pilog</a> 2476 <a href="refS.html#solve">solve</a> 2477 <a href="refQ.html#query">query</a> 2478 <a href="ref_.html#?">?</a> 2479 <a href="refR.html#repeat/0">repeat/0</a> 2480 <a href="refF.html#fail/0">fail/0</a> 2481 <a href="refT.html#true/0">true/0</a> 2482 <a href="refN.html#not/1">not/1</a> 2483 <a href="refC.html#call/1">call/1</a> 2484 <a href="refO.html#or/2">or/2</a> 2485 <a href="refN.html#nil/1">nil/1</a> 2486 <a href="refE.html#equal/2">equal/2</a> 2487 <a href="refD.html#different/2">different/2</a> 2488 <a href="refA.html#append/3">append/3</a> 2489 <a href="refM.html#member/2">member/2</a> 2490 <a href="refD.html#delete/3">delete/3</a> 2491 <a href="refP.html#permute/2">permute/2</a> 2492 <a href="refU.html#uniq/2">uniq/2</a> 2493 <a href="refA.html#asserta/1">asserta/1</a> 2494 <a href="refA.html#assertz/1">assertz/1</a> 2495 <a href="refR.html#retract/1">retract/1</a> 2496 <a href="refC.html#clause/2">clause/2</a> 2497 <a href="refS.html#show/1">show/1</a> 2498 <a href="refD.html#db/3">db/3</a> 2499 <a href="refD.html#db/4">db/4</a> 2500 <a href="refD.html#db/5">db/5</a> 2501 <a href="refV.html#val/3">val/3</a> 2502 <a href="refL.html#lst/3">lst/3</a> 2503 <a href="refM.html#map/3">map/3</a> 2504 <a href="refI.html#isa/2">isa/2</a> 2505 <a href="refS.html#same/3">same/3</a> 2506 <a href="refB.html#bool/3">bool/3</a> 2507 <a href="refR.html#range/3">range/3</a> 2508 <a href="refH.html#head/3">head/3</a> 2509 <a href="refF.html#fold/3">fold/3</a> 2510 <a href="refP.html#part/3">part/3</a> 2511 <a href="refT.html#tolr/3">tolr/3</a> 2512 <a href="refS.html#select/3">select/3</a> 2513 <a href="refR.html#remote/2">remote/2</a> 2514 </code> 2515 2516 <dt>Debugging 2517 <dd><code> 2518 <a href="refP.html#pretty">pretty</a> 2519 <a href="refP.html#pp">pp</a> 2520 <a href="refS.html#show">show</a> 2521 <a href="refL.html#loc">loc</a> 2522 <a href="refD.html#*Dbg">*Dbg</a> 2523 <a href="refD.html#doc">doc</a> 2524 <a href="refM.html#more">more</a> 2525 <a href="refD.html#depth">depth</a> 2526 <a href="refW.html#what">what</a> 2527 <a href="refW.html#who">who</a> 2528 <a href="refC.html#can">can</a> 2529 <a href="refD.html#dep">dep</a> 2530 <a href="refD.html#debug">debug</a> 2531 <a href="refD.html#d">d</a> 2532 <a href="refU.html#unbug">unbug</a> 2533 <a href="refU.html#u">u</a> 2534 <a href="refV.html#vi">vi</a> 2535 <a href="refE.html#em">em</a> 2536 <a href="refL.html#ld">ld</a> 2537 <a href="refT.html#trace">trace</a> 2538 <a href="refU.html#untrace">untrace</a> 2539 <a href="refT.html#traceAll">traceAll</a> 2540 <a href="refP.html#proc">proc</a> 2541 <a href="refH.html#hd">hd</a> 2542 <a href="refB.html#bench">bench</a> 2543 <a href="refE.html#edit">edit</a> 2544 <a href="refL.html#lint">lint</a> 2545 <a href="refL.html#lintAll">lintAll</a> 2546 <a href="refS.html#select">select</a> 2547 <a href="refU.html#update">update</a> 2548 </code> 2549 2550 <dt>System Functions 2551 <dd><code> 2552 <a href="refC.html#cmd">cmd</a> 2553 <a href="refA.html#argv">argv</a> 2554 <a href="refO.html#opt">opt</a> 2555 <a href="refV.html#version">version</a> 2556 <a href="refG.html#gc">gc</a> 2557 <a href="refR.html#raw">raw</a> 2558 <a href="refA.html#alarm">alarm</a> 2559 <a href="refP.html#protect">protect</a> 2560 <a href="refH.html#heap">heap</a> 2561 <a href="refS.html#stack">stack</a> 2562 <a href="refA.html#adr">adr</a> 2563 <a href="refE.html#env">env</a> 2564 <a href="refT.html#trail">trail</a> 2565 <a href="refU.html#up">up</a> 2566 <a href="refS.html#sys">sys</a> 2567 <a href="refD.html#date">date</a> 2568 <a href="refT.html#time">time</a> 2569 <a href="refU.html#usec">usec</a> 2570 <a href="refS.html#stamp">stamp</a> 2571 <a href="refD.html#dat$">dat$</a> 2572 <a href="ref_.html#$dat">$dat</a> 2573 <a href="refD.html#datSym">datSym</a> 2574 <a href="refD.html#datStr">datStr</a> 2575 <a href="refS.html#strDat">strDat</a> 2576 <a href="refE.html#expDat">expDat</a> 2577 <a href="refD.html#day">day</a> 2578 <a href="refW.html#week">week</a> 2579 <a href="refU.html#ultimo">ultimo</a> 2580 <a href="refT.html#tim$">tim$</a> 2581 <a href="ref_.html#$tim">$tim</a> 2582 <a href="refT.html#telStr">telStr</a> 2583 <a href="refE.html#expTel">expTel</a> 2584 <a href="refL.html#locale">locale</a> 2585 <a href="refA.html#allowed">allowed</a> 2586 <a href="refA.html#allow">allow</a> 2587 <a href="refP.html#pwd">pwd</a> 2588 <a href="refC.html#cd">cd</a> 2589 <a href="refC.html#chdir">chdir</a> 2590 <a href="refC.html#ctty">ctty</a> 2591 <a href="refI.html#info">info</a> 2592 <a href="refD.html#dir">dir</a> 2593 <a href="refD.html#dirname">dirname</a> 2594 <a href="refE.html#errno">errno</a> 2595 <a href="refN.html#native">native</a> 2596 <a href="refC.html#call">call</a> 2597 <a href="refT.html#tick">tick</a> 2598 <a href="refK.html#kill">kill</a> 2599 <a href="refQ.html#quit">quit</a> 2600 <a href="refT.html#task">task</a> 2601 <a href="refF.html#fork">fork</a> 2602 <a href="refF.html#forked">forked</a> 2603 <a href="refP.html#pipe">pipe</a> 2604 <a href="refT.html#timeout">timeout</a> 2605 <a href="refM.html#mail">mail</a> 2606 <a href="refA.html#assert">assert</a> 2607 <a href="refT.html#test">test</a> 2608 <a href="refB.html#bye">bye</a> 2609 </code> 2610 2611 <dt>Globals 2612 <dd><code> 2613 <a href="#nilSym">NIL</a> 2614 <a href="refP.html#pico">pico</a> 2615 <a href="refC.html#*CPU">*CPU</a> 2616 <a href="refO.html#*OS">*OS</a> 2617 <a href="refD.html#*DB">*DB</a> 2618 <a href="refT.html#T">T</a> 2619 <a href="refS.html#*Solo">*Solo</a> 2620 <a href="refP.html#*PPid">*PPid</a> 2621 <a href="refP.html#*Pid">*Pid</a> 2622 <a href="ref_.html#@">@</a> 2623 <a href="ref_.html#@@">@@</a> 2624 <a href="ref_.html#@@@">@@@</a> 2625 <a href="refT.html#This">This</a> 2626 <a href="refP.html#*Prompt">*Prompt</a> 2627 <a href="refD.html#*Dbg">*Dbg</a> 2628 <a href="refZ.html#*Zap">*Zap</a> 2629 <a href="refS.html#*Scl">*Scl</a> 2630 <a href="refC.html#*Class">*Class</a> 2631 <a href="refD.html#*Dbs">*Dbs</a> 2632 <a href="refR.html#*Run">*Run</a> 2633 <a href="refH.html#*Hup">*Hup</a> 2634 <a href="refS.html#*Sig1">*Sig1</a> 2635 <a href="refS.html#*Sig2">*Sig2</a> 2636 <a href="ref_.html#^">^</a> 2637 <a href="refE.html#*Err">*Err</a> 2638 <a href="refM.html#*Msg">*Msg</a> 2639 <a href="refU.html#*Uni">*Uni</a> 2640 <a href="refL.html#*Led">*Led</a> 2641 <a href="refT.html#*Tsm">*Tsm</a> 2642 <a href="refA.html#*Adr">*Adr</a> 2643 <a href="refA.html#*Allow">*Allow</a> 2644 <a href="refF.html#*Fork">*Fork</a> 2645 <a href="refB.html#*Bye">*Bye</a> 2646 </code> 2647 2648 </dl> 2649 2650 <p><hr> 2651 <h2><a name="down">Download</a></h2> 2652 2653 <p>The <code>PicoLisp</code> system can be downloaded from the <a 2654 href="http://software-lab.de/down.html">PicoLisp Download</a> page. 2655 2656 <script type="text/javascript"> 2657 var sortBtn; 2658 2659 if (document.querySelectorAll) { 2660 sortBtn = document.createElement("input"); 2661 sortBtn.setAttribute("type", "button"); 2662 sortBtn.setAttribute("onclick", "sortFunWords()"); 2663 sortBtn.value = "Sort Words Alphabetically"; 2664 document.getElementById("sortBtnHome").appendChild(sortBtn); 2665 }; 2666 2667 function sortFunWords() { 2668 var dls = document.querySelectorAll("dl"), funDl = dls[dls.length-1]; 2669 var cats = funDl.querySelectorAll("dd code"); 2670 for (var c=0; c<cats.length; c++) { 2671 var aElems = cats[c].querySelectorAll("a"), aArr = []; 2672 for (var i=0; i<aElems.length; i++) { aArr.push(aElems[i]); } 2673 aArr.sort(function(a,b) { return (a.innerHTML < b.innerHTML) ? -1 : 1; }); 2674 var dd = cats[c].parentNode; 2675 dd.removeChild(cats[c]); 2676 var newCode = document.createElement("code"); 2677 dd.appendChild(newCode); 2678 for (var i=0; i<aArr.length; i++) { 2679 newCode.appendChild(aArr[i]); 2680 newCode.appendChild(document.createTextNode(" ")); 2681 } 2682 } 2683 sortBtn.setAttribute("disabled", "disabled"); 2684 } 2685 </script> 2686 2687 </body> 2688 </html>