raw
asciilifeform_shi...    1 
asciilifeform_shi... 2
asciilifeform_shi... 3 TinySCHEME Version 1.41
asciilifeform_shi... 4
asciilifeform_shi... 5 "Safe if used as prescribed"
asciilifeform_shi... 6 -- Philip K. Dick, "Ubik"
asciilifeform_shi... 7
asciilifeform_shi... 8 This software is open source, covered by a BSD-style license.
asciilifeform_shi... 9 Please read accompanying file COPYING.
asciilifeform_shi... 10 -------------------------------------------------------------------------------
asciilifeform_shi... 11
asciilifeform_shi... 12 This Scheme interpreter is based on MiniSCHEME version 0.85k4
asciilifeform_shi... 13 (see miniscm.tar.gz in the Scheme Repository)
asciilifeform_shi... 14 Original credits in file MiniSCHEMETribute.txt.
asciilifeform_shi... 15
asciilifeform_shi... 16 D. Souflis (dsouflis@acm.org)
asciilifeform_shi... 17
asciilifeform_shi... 18 -------------------------------------------------------------------------------
asciilifeform_shi... 19 What is TinyScheme?
asciilifeform_shi... 20 -------------------
asciilifeform_shi... 21
asciilifeform_shi... 22 TinyScheme is a lightweight Scheme interpreter that implements as large
asciilifeform_shi... 23 a subset of R5RS as was possible without getting very large and
asciilifeform_shi... 24 complicated. It is meant to be used as an embedded scripting interpreter
asciilifeform_shi... 25 for other programs. As such, it does not offer IDEs or extensive toolkits
asciilifeform_shi... 26 although it does sport a small top-level loop, included conditionally.
asciilifeform_shi... 27 A lot of functionality in TinyScheme is included conditionally, to allow
asciilifeform_shi... 28 developers freedom in balancing features and footprint.
asciilifeform_shi... 29
asciilifeform_shi... 30 As an embedded interpreter, it allows multiple interpreter states to
asciilifeform_shi... 31 coexist in the same program, without any interference between them.
asciilifeform_shi... 32 Programmatically, foreign functions in C can be added and values
asciilifeform_shi... 33 can be defined in the Scheme environment. Being a quite small program,
asciilifeform_shi... 34 it is easy to comprehend, get to grips with, and use.
asciilifeform_shi... 35
asciilifeform_shi... 36 Known bugs
asciilifeform_shi... 37 ----------
asciilifeform_shi... 38
asciilifeform_shi... 39 TinyScheme is known to misbehave when memory is exhausted.
asciilifeform_shi... 40
asciilifeform_shi... 41
asciilifeform_shi... 42 Things that keep missing, or that need fixing
asciilifeform_shi... 43 ---------------------------------------------
asciilifeform_shi... 44
asciilifeform_shi... 45 There are no hygienic macros. No rational or
asciilifeform_shi... 46 complex numbers. No unwind-protect and call-with-values.
asciilifeform_shi... 47
asciilifeform_shi... 48 Maybe (a subset of) SLIB will work with TinySCHEME...
asciilifeform_shi... 49
asciilifeform_shi... 50 Decent debugging facilities are missing. Only tracing is supported
asciilifeform_shi... 51 natively.
asciilifeform_shi... 52
asciilifeform_shi... 53
asciilifeform_shi... 54 Scheme Reference
asciilifeform_shi... 55 ----------------
asciilifeform_shi... 56
asciilifeform_shi... 57 If something seems to be missing, please refer to the code and
asciilifeform_shi... 58 "init.scm", since some are library functions. Refer to the MiniSCHEME
asciilifeform_shi... 59 readme as a last resort.
asciilifeform_shi... 60
asciilifeform_shi... 61 Environments
asciilifeform_shi... 62 (interaction-environment)
asciilifeform_shi... 63 See R5RS. In TinySCHEME, immutable list of association lists.
asciilifeform_shi... 64
asciilifeform_shi... 65 (current-environment)
asciilifeform_shi... 66 The environment in effect at the time of the call. An example of its
asciilifeform_shi... 67 use and its utility can be found in the sample code that implements
asciilifeform_shi... 68 packages in "init.scm":
asciilifeform_shi... 69
asciilifeform_shi... 70 (macro (package form)
asciilifeform_shi... 71 `(apply (lambda ()
asciilifeform_shi... 72 ,@(cdr form)
asciilifeform_shi... 73 (current-environment))))
asciilifeform_shi... 74
asciilifeform_shi... 75 The environment containing the (local) definitions inside the closure
asciilifeform_shi... 76 is returned as an immutable value.
asciilifeform_shi... 77
asciilifeform_shi... 78 (defined? <symbol>) (defined? <symbol> <environment>)
asciilifeform_shi... 79 Checks whether the given symbol is defined in the current (or given)
asciilifeform_shi... 80 environment.
asciilifeform_shi... 81
asciilifeform_shi... 82 Symbols
asciilifeform_shi... 83 (gensym)
asciilifeform_shi... 84 Returns a new interned symbol each time. Will probably move to the
asciilifeform_shi... 85 library when string->symbol is implemented.
asciilifeform_shi... 86
asciilifeform_shi... 87 Directives
asciilifeform_shi... 88 (gc)
asciilifeform_shi... 89 Performs garbage collection immediatelly.
asciilifeform_shi... 90
asciilifeform_shi... 91 (gcverbose) (gcverbose <bool>)
asciilifeform_shi... 92 The argument (defaulting to #t) controls whether GC produces
asciilifeform_shi... 93 visible outcome.
asciilifeform_shi... 94
asciilifeform_shi... 95 (quit) (quit <num>)
asciilifeform_shi... 96 Stops the interpreter and sets the 'retcode' internal field (defaults
asciilifeform_shi... 97 to 0). When standalone, 'retcode' is returned as exit code to the OS.
asciilifeform_shi... 98
asciilifeform_shi... 99 (tracing <num>)
asciilifeform_shi... 100 1, turns on tracing. 0 turns it off. (Only when USE_TRACING is 1).
asciilifeform_shi... 101
asciilifeform_shi... 102 Mathematical functions
asciilifeform_shi... 103 Since rationals and complexes are absent, the respective functions
asciilifeform_shi... 104 are also missing.
asciilifeform_shi... 105 Supported: exp, log, sin, cos, tan, asin, acos, atan, floor, ceiling,
asciilifeform_shi... 106 trunc, round and also sqrt and expt when USE_MATH=1.
asciilifeform_shi... 107 Number-theoretical quotient, remainder and modulo, gcd, lcm.
asciilifeform_shi... 108 Library: exact?, inexact?, odd?, even?, zero?, positive?, negative?,
asciilifeform_shi... 109 exact->inexact. inexact->exact is a core function.
asciilifeform_shi... 110
asciilifeform_shi... 111 Type predicates
asciilifeform_shi... 112 boolean?,eof-object?,symbol?,number?,string?,integer?,real?,list?,null?,
asciilifeform_shi... 113 char?,port?,input-port?,output-port?,procedure?,pair?,environment?',
asciilifeform_shi... 114 vector?. Also closure?, macro?.
asciilifeform_shi... 115
asciilifeform_shi... 116 Types
asciilifeform_shi... 117 Types supported:
asciilifeform_shi... 118
asciilifeform_shi... 119 Numbers (integers and reals)
asciilifeform_shi... 120 Symbols
asciilifeform_shi... 121 Pairs
asciilifeform_shi... 122 Strings
asciilifeform_shi... 123 Characters
asciilifeform_shi... 124 Ports
asciilifeform_shi... 125 Eof object
asciilifeform_shi... 126 Environments
asciilifeform_shi... 127 Vectors
asciilifeform_shi... 128
asciilifeform_shi... 129 Literals
asciilifeform_shi... 130 String literals can contain escaped quotes \" as usual, but also
asciilifeform_shi... 131 \n, \r, \t, \xDD (hex representations) and \DDD (octal representations).
asciilifeform_shi... 132 Note also that it is possible to include literal newlines in string
asciilifeform_shi... 133 literals, e.g.
asciilifeform_shi... 134
asciilifeform_shi... 135 (define s "String with newline here
asciilifeform_shi... 136 and here
asciilifeform_shi... 137 that can function like a HERE-string")
asciilifeform_shi... 138
asciilifeform_shi... 139 Character literals contain #\space and #\newline and are supplemented
asciilifeform_shi... 140 with #\return and #\tab, with obvious meanings. Hex character
asciilifeform_shi... 141 representations are allowed (e.g. #\x20 is #\space).
asciilifeform_shi... 142 When USE_ASCII_NAMES is defined, various control characters can be
asciilifeform_shi... 143 referred to by their ASCII name.
asciilifeform_shi... 144 0 #\nul 17 #\dc1
asciilifeform_shi... 145 1 #\soh 18 #\dc2
asciilifeform_shi... 146 2 #\stx 19 #\dc3
asciilifeform_shi... 147 3 #\etx 20 #\dc4
asciilifeform_shi... 148 4 #\eot 21 #\nak
asciilifeform_shi... 149 5 #\enq 22 #\syn
asciilifeform_shi... 150 6 #\ack 23 #\etv
asciilifeform_shi... 151 7 #\bel 24 #\can
asciilifeform_shi... 152 8 #\bs 25 #\em
asciilifeform_shi... 153 9 #\ht 26 #\sub
asciilifeform_shi... 154 10 #\lf 27 #\esc
asciilifeform_shi... 155 11 #\vt 28 #\fs
asciilifeform_shi... 156 12 #\ff 29 #\gs
asciilifeform_shi... 157 13 #\cr 30 #\rs
asciilifeform_shi... 158 14 #\so 31 #\us
asciilifeform_shi... 159 15 #\si
asciilifeform_shi... 160 16 #\dle 127 #\del
asciilifeform_shi... 161
asciilifeform_shi... 162 Numeric literals support #x #o #b and #d. Flonums are currently read only
asciilifeform_shi... 163 in decimal notation. Full grammar will be supported soon.
asciilifeform_shi... 164
asciilifeform_shi... 165 Quote, quasiquote etc.
asciilifeform_shi... 166 As usual.
asciilifeform_shi... 167
asciilifeform_shi... 168 Immutable values
asciilifeform_shi... 169 Immutable pairs cannot be modified by set-car! and set-cdr!.
asciilifeform_shi... 170 Immutable strings cannot be modified via string-set!
asciilifeform_shi... 171
asciilifeform_shi... 172 I/O
asciilifeform_shi... 173 As per R5RS, plus String Ports (see below).
asciilifeform_shi... 174 current-input-port, current-output-port,
asciilifeform_shi... 175 close-input-port, close-output-port, input-port?, output-port?,
asciilifeform_shi... 176 open-input-file, open-output-file.
asciilifeform_shi... 177 read, write, display, newline, write-char, read-char, peek-char.
asciilifeform_shi... 178 char-ready? returns #t only for string ports, because there is no
asciilifeform_shi... 179 portable way in stdio to determine if a character is available.
asciilifeform_shi... 180 Also open-input-output-file, set-input-port, set-output-port (not R5RS)
asciilifeform_shi... 181 Library: call-with-input-file, call-with-output-file,
asciilifeform_shi... 182 with-input-from-file, with-output-from-file and
asciilifeform_shi... 183 with-input-output-from-to-files, close-port and input-output-port?
asciilifeform_shi... 184 (not R5RS).
asciilifeform_shi... 185 String Ports: open-input-string, open-output-string, get-output-string,
asciilifeform_shi... 186 open-input-output-string. Strings can be used with I/O routines.
asciilifeform_shi... 187
asciilifeform_shi... 188 Vectors
asciilifeform_shi... 189 make-vector, vector, vector-length, vector-ref, vector-set!, list->vector,
asciilifeform_shi... 190 vector-fill!, vector->list, vector-equal? (auxiliary function, not R5RS)
asciilifeform_shi... 191
asciilifeform_shi... 192 Strings
asciilifeform_shi... 193 string, make-string, list->string, string-length, string-ref, string-set!,
asciilifeform_shi... 194 substring, string->list, string-fill!, string-append, string-copy.
asciilifeform_shi... 195 string=?, string<?, string>?, string>?, string<=?, string>=?.
asciilifeform_shi... 196 (No string-ci*? yet). string->number, number->string. Also atom->string,
asciilifeform_shi... 197 string->atom (not R5RS).
asciilifeform_shi... 198
asciilifeform_shi... 199 Symbols
asciilifeform_shi... 200 symbol->string, string->symbol
asciilifeform_shi... 201
asciilifeform_shi... 202 Characters
asciilifeform_shi... 203 integer->char, char->integer.
asciilifeform_shi... 204 char=?, char<?, char>?, char<=?, char>=?.
asciilifeform_shi... 205 (No char-ci*?)
asciilifeform_shi... 206
asciilifeform_shi... 207 Pairs & Lists
asciilifeform_shi... 208 cons, car, cdr, list, length, map, for-each, foldr, list-tail,
asciilifeform_shi... 209 list-ref, last-pair, reverse, append.
asciilifeform_shi... 210 Also member, memq, memv, based on generic-member, assoc, assq, assv
asciilifeform_shi... 211 based on generic-assoc.
asciilifeform_shi... 212
asciilifeform_shi... 213 Streams
asciilifeform_shi... 214 head, tail, cons-stream
asciilifeform_shi... 215
asciilifeform_shi... 216 Control features
asciilifeform_shi... 217 Apart from procedure?, also macro? and closure?
asciilifeform_shi... 218 map, for-each, force, delay, call-with-current-continuation (or call/cc),
asciilifeform_shi... 219 eval, apply. 'Forcing' a value that is not a promise produces the value.
asciilifeform_shi... 220 There is no call-with-values, values, nor dynamic-wind. Dynamic-wind in
asciilifeform_shi... 221 the presence of continuations would require support from the abstract
asciilifeform_shi... 222 machine itself.
asciilifeform_shi... 223
asciilifeform_shi... 224 Property lists
asciilifeform_shi... 225 TinyScheme inherited from MiniScheme property lists for symbols.
asciilifeform_shi... 226 put, get.
asciilifeform_shi... 227
asciilifeform_shi... 228 Dynamically-loaded extensions
asciilifeform_shi... 229 (load-extension <filename without extension>)
asciilifeform_shi... 230 Loads a DLL declaring foreign procedures. On Unix/Linux, one can make use
asciilifeform_shi... 231 of the ld.so.conf file or the LD_RUN_PATH system variable in order to place
asciilifeform_shi... 232 the library in a directory other than the current one. Please refer to the
asciilifeform_shi... 233 appropriate 'man' page.
asciilifeform_shi... 234
asciilifeform_shi... 235 Esoteric procedures
asciilifeform_shi... 236 (oblist)
asciilifeform_shi... 237 Returns the oblist, an immutable list of all the symbols.
asciilifeform_shi... 238
asciilifeform_shi... 239 (macro-expand <form>)
asciilifeform_shi... 240 Returns the expanded form of the macro call denoted by the argument
asciilifeform_shi... 241
asciilifeform_shi... 242 (define-with-return (<procname> <args>...) <body>)
asciilifeform_shi... 243 Like plain 'define', but makes the continuation available as 'return'
asciilifeform_shi... 244 inside the procedure. Handy for imperative programs.
asciilifeform_shi... 245
asciilifeform_shi... 246 (new-segment <num>)
asciilifeform_shi... 247 Allocates more memory segments.
asciilifeform_shi... 248
asciilifeform_shi... 249 defined?
asciilifeform_shi... 250 See "Environments"
asciilifeform_shi... 251
asciilifeform_shi... 252 (get-closure-code <closure>)
asciilifeform_shi... 253 Gets the code as scheme data.
asciilifeform_shi... 254
asciilifeform_shi... 255 (make-closure <code> <environment>)
asciilifeform_shi... 256 Makes a new closure in the given environment.
asciilifeform_shi... 257
asciilifeform_shi... 258 Obsolete procedures
asciilifeform_shi... 259 (print-width <object>)
asciilifeform_shi... 260
asciilifeform_shi... 261 Programmer's Reference
asciilifeform_shi... 262 ----------------------
asciilifeform_shi... 263
asciilifeform_shi... 264 The interpreter state is initialized with "scheme_init".
asciilifeform_shi... 265 Custom memory allocation routines can be installed with an alternate
asciilifeform_shi... 266 initialization function: "scheme_init_custom_alloc".
asciilifeform_shi... 267 Files can be loaded with "scheme_load_file". Strings containing Scheme
asciilifeform_shi... 268 code can be loaded with "scheme_load_string". It is a good idea to
asciilifeform_shi... 269 "scheme_load" init.scm before anything else.
asciilifeform_shi... 270
asciilifeform_shi... 271 External data for keeping external state (of use to foreign functions)
asciilifeform_shi... 272 can be installed with "scheme_set_external_data".
asciilifeform_shi... 273 Foreign functions are installed with "assign_foreign". Additional
asciilifeform_shi... 274 definitions can be added to the interpreter state, with "scheme_define"
asciilifeform_shi... 275 (this is the way HTTP header data and HTML form data are passed to the
asciilifeform_shi... 276 Scheme script in the Altera SQL Server). If you wish to define the
asciilifeform_shi... 277 foreign function in a specific environment (to enhance modularity),
asciilifeform_shi... 278 use "assign_foreign_env".
asciilifeform_shi... 279
asciilifeform_shi... 280 The procedure "scheme_apply0" has been added with persistent scripts in
asciilifeform_shi... 281 mind. Persistent scripts are loaded once, and every time they are needed
asciilifeform_shi... 282 to produce HTTP output, appropriate data are passed through global
asciilifeform_shi... 283 definitions and function "main" is called to do the job. One could
asciilifeform_shi... 284 add easily "scheme_apply1" etc.
asciilifeform_shi... 285
asciilifeform_shi... 286 The interpreter state should be deinitialized with "scheme_deinit".
asciilifeform_shi... 287
asciilifeform_shi... 288 DLLs containing foreign functions should define a function named
asciilifeform_shi... 289 init_<base-name>. E.g. foo.dll should define init_foo, and bar.so
asciilifeform_shi... 290 should define init_bar. This function should assign_foreign any foreign
asciilifeform_shi... 291 function contained in the DLL.
asciilifeform_shi... 292
asciilifeform_shi... 293 The first dynamically loaded extension available for TinyScheme is
asciilifeform_shi... 294 a regular expression library. Although it's by no means an
asciilifeform_shi... 295 established standard, this library is supposed to be installed in
asciilifeform_shi... 296 a directory mirroring its name under the TinyScheme location.
asciilifeform_shi... 297
asciilifeform_shi... 298
asciilifeform_shi... 299 Foreign Functions
asciilifeform_shi... 300 -----------------
asciilifeform_shi... 301
asciilifeform_shi... 302 The user can add foreign functions in C. For example, a function
asciilifeform_shi... 303 that squares its argument:
asciilifeform_shi... 304
asciilifeform_shi... 305 pointer square(scheme *sc, pointer args) {
asciilifeform_shi... 306 if(args!=sc->NIL) {
asciilifeform_shi... 307 if(sc->isnumber(sc->pair_car(args))) {
asciilifeform_shi... 308 double v=sc->rvalue(sc->pair_car(args));
asciilifeform_shi... 309 return sc->mk_real(sc,v*v);
asciilifeform_shi... 310 }
asciilifeform_shi... 311 }
asciilifeform_shi... 312 return sc->NIL;
asciilifeform_shi... 313 }
asciilifeform_shi... 314
asciilifeform_shi... 315 Foreign functions are now defined as closures:
asciilifeform_shi... 316
asciilifeform_shi... 317 sc->interface->scheme_define(
asciilifeform_shi... 318 sc,
asciilifeform_shi... 319 sc->global_env,
asciilifeform_shi... 320 sc->interface->mk_symbol(sc,"square"),
asciilifeform_shi... 321 sc->interface->mk_foreign_func(sc, square));
asciilifeform_shi... 322
asciilifeform_shi... 323
asciilifeform_shi... 324 Foreign functions can use the external data in the "scheme" struct
asciilifeform_shi... 325 to implement any kind of external state.
asciilifeform_shi... 326
asciilifeform_shi... 327 External data are set with the following function:
asciilifeform_shi... 328 void scheme_set_external_data(scheme *sc, void *p);
asciilifeform_shi... 329
asciilifeform_shi... 330 As of v.1.17, the canonical way for a foreign function in a DLL to
asciilifeform_shi... 331 manipulate Scheme data is using the function pointers in sc->interface.
asciilifeform_shi... 332
asciilifeform_shi... 333 Standalone
asciilifeform_shi... 334 ----------
asciilifeform_shi... 335
asciilifeform_shi... 336 Usage: tinyscheme -?
asciilifeform_shi... 337 or: tinyscheme [<file1> <file2> ...]
asciilifeform_shi... 338 followed by
asciilifeform_shi... 339 -1 <file> [<arg1> <arg2> ...]
asciilifeform_shi... 340 -c <Scheme commands> [<arg1> <arg2> ...]
asciilifeform_shi... 341 assuming that the executable is named tinyscheme.
asciilifeform_shi... 342
asciilifeform_shi... 343 Use - in the place of a filename to denote stdin.
asciilifeform_shi... 344 The -1 flag is meant for #! usage in shell scripts. If you specify
asciilifeform_shi... 345 #! /somewhere/tinyscheme -1
asciilifeform_shi... 346 then tinyscheme will be called to process the file. For example, the
asciilifeform_shi... 347 following script echoes the Scheme list of its arguments.
asciilifeform_shi... 348
asciilifeform_shi... 349 #! /somewhere/tinyscheme -1
asciilifeform_shi... 350 (display *args*)
asciilifeform_shi... 351
asciilifeform_shi... 352 The -c flag permits execution of arbitrary Scheme code.
asciilifeform_shi... 353
asciilifeform_shi... 354
asciilifeform_shi... 355 Error Handling
asciilifeform_shi... 356 --------------
asciilifeform_shi... 357
asciilifeform_shi... 358 Errors are recovered from without damage. The user can install his
asciilifeform_shi... 359 own handler for system errors, by defining *error-hook*. Defining
asciilifeform_shi... 360 to '() gives the default behavior, which is equivalent to "error".
asciilifeform_shi... 361 USE_ERROR_HOOK must be defined.
asciilifeform_shi... 362
asciilifeform_shi... 363 A simple exception handling mechanism can be found in "init.scm".
asciilifeform_shi... 364 A new syntactic form is introduced:
asciilifeform_shi... 365
asciilifeform_shi... 366 (catch <expr returned exceptionally>
asciilifeform_shi... 367 <expr1> <expr2> ... <exprN>)
asciilifeform_shi... 368
asciilifeform_shi... 369 "Catch" establishes a scope spanning multiple call-frames
asciilifeform_shi... 370 until another "catch" is encountered.
asciilifeform_shi... 371
asciilifeform_shi... 372 Exceptions are thrown with:
asciilifeform_shi... 373
asciilifeform_shi... 374 (throw "message")
asciilifeform_shi... 375
asciilifeform_shi... 376 If used outside a (catch ...), reverts to (error "message").
asciilifeform_shi... 377
asciilifeform_shi... 378 Example of use:
asciilifeform_shi... 379
asciilifeform_shi... 380 (define (foo x) (write x) (newline) (/ x 0))
asciilifeform_shi... 381
asciilifeform_shi... 382 (catch (begin (display "Error!\n") 0)
asciilifeform_shi... 383 (write "Before foo ... ")
asciilifeform_shi... 384 (foo 5)
asciilifeform_shi... 385 (write "After foo"))
asciilifeform_shi... 386
asciilifeform_shi... 387 The exception mechanism can be used even by system errors, by
asciilifeform_shi... 388
asciilifeform_shi... 389 (define *error-hook* throw)
asciilifeform_shi... 390
asciilifeform_shi... 391 which makes use of the error hook described above.
asciilifeform_shi... 392
asciilifeform_shi... 393 If necessary, the user can devise his own exception mechanism with
asciilifeform_shi... 394 tagged exceptions etc.
asciilifeform_shi... 395
asciilifeform_shi... 396
asciilifeform_shi... 397 Reader extensions
asciilifeform_shi... 398 -----------------
asciilifeform_shi... 399
asciilifeform_shi... 400 When encountering an unknown character after '#', the user-specified
asciilifeform_shi... 401 procedure *sharp-hook* (if any), is called to read the expression.
asciilifeform_shi... 402 This can be used to extend the reader to handle user-defined constants
asciilifeform_shi... 403 or whatever. It should be a procedure without arguments, reading from
asciilifeform_shi... 404 the current input port (which will be the load-port).
asciilifeform_shi... 405
asciilifeform_shi... 406
asciilifeform_shi... 407 Colon Qualifiers - Packages
asciilifeform_shi... 408 ---------------------------
asciilifeform_shi... 409
asciilifeform_shi... 410 When USE_COLON_HOOK=1:
asciilifeform_shi... 411 The lexer now recognizes the construction <qualifier>::<symbol> and
asciilifeform_shi... 412 transforms it in the following manner (T is the transformation function):
asciilifeform_shi... 413
asciilifeform_shi... 414 T(<qualifier>::<symbol>) = (*colon-hook* 'T(<symbol>) <qualifier>)
asciilifeform_shi... 415
asciilifeform_shi... 416 where <qualifier> is a symbol not containing any double-colons.
asciilifeform_shi... 417
asciilifeform_shi... 418 As the definition is recursive, qualifiers can be nested.
asciilifeform_shi... 419 The user can define his own *colon-hook*, to handle qualified names.
asciilifeform_shi... 420 By default, "init.scm" defines *colon-hook* as EVAL. Consequently,
asciilifeform_shi... 421 the qualifier must denote a Scheme environment, such as one returned
asciilifeform_shi... 422 by (interaction-environment). "Init.scm" defines a new syntantic form,
asciilifeform_shi... 423 PACKAGE, as a simple example. It is used like this:
asciilifeform_shi... 424
asciilifeform_shi... 425 (define toto
asciilifeform_shi... 426 (package
asciilifeform_shi... 427 (define foo 1)
asciilifeform_shi... 428 (define bar +)))
asciilifeform_shi... 429
asciilifeform_shi... 430 foo ==> Error, "foo" undefined
asciilifeform_shi... 431 (eval 'foo) ==> Error, "foo" undefined
asciilifeform_shi... 432 (eval 'foo toto) ==> 1
asciilifeform_shi... 433 toto::foo ==> 1
asciilifeform_shi... 434 ((eval 'bar toto) 2 (eval 'foo toto)) ==> 3
asciilifeform_shi... 435 (toto::bar 2 toto::foo) ==> 3
asciilifeform_shi... 436 (eval (bar 2 foo) toto) ==> 3
asciilifeform_shi... 437
asciilifeform_shi... 438 If the user installs another package infrastructure, he must define
asciilifeform_shi... 439 a new 'package' procedure or macro to retain compatibility with supplied
asciilifeform_shi... 440 code.
asciilifeform_shi... 441
asciilifeform_shi... 442 Note: Older versions used ':' as a qualifier. Unfortunately, the use
asciilifeform_shi... 443 of ':' as a pseudo-qualifier in existing code (i.e. SLIB) essentially
asciilifeform_shi... 444 precludes its use as a real qualifier.
asciilifeform_shi... 445
asciilifeform_shi... 446
asciilifeform_shi... 447
asciilifeform_shi... 448
asciilifeform_shi... 449
asciilifeform_shi... 450
asciilifeform_shi... 451
asciilifeform_shi... 452