* Minor docstring updates.
[bpt/guile.git] / doc / maint / guile.texi
1 @paragraphindent 0
2
3 \facons
4 @c snarfed from alist.c:60
5 @deffn primitive acons key value alist
6 Adds a new key-value pair to @var{alist}. A new pair is
7 created whose car is @var{key} and whose cdr is @var{value}, and the
8 pair is consed onto @var{alist}, and the new list is returned. This
9 function is @emph{not} destructive; @var{alist} is not modified.
10 @end deffn
11
12 \fsloppy-assq
13 @c snarfed from alist.c:83
14 @deffn primitive sloppy-assq key alist
15 Behaves like @code{assq} but does not do any error checking.
16 Recommended only for use in Guile internals.
17 @end deffn
18
19 \fsloppy-assv
20 @c snarfed from alist.c:101
21 @deffn primitive sloppy-assv key alist
22 Behaves like @code{assv} but does not do any error checking.
23 Recommended only for use in Guile internals.
24 @end deffn
25
26 \fsloppy-assoc
27 @c snarfed from alist.c:119
28 @deffn primitive sloppy-assoc key alist
29 Behaves like @code{assoc} but does not do any error checking.
30 Recommended only for use in Guile internals.
31 @end deffn
32
33 \fassq
34 @c snarfed from alist.c:146
35 @deffn primitive assq key alist
36 @deffnx primitive assv key alist
37 @deffnx primitive assoc key alist
38 Fetches the entry in @var{alist} that is associated with @var{key}. To
39 decide whether the argument @var{key} matches a particular entry in
40 @var{alist}, @code{assq} compares keys with @code{eq?}, @code{assv}
41 uses @code{eqv?} and @code{assoc} uses @code{equal?}. If @var{key}
42 cannot be found in @var{alist} (according to whichever equality
43 predicate is in use), then @code{#f} is returned. These functions
44 return the entire alist entry found (i.e. both the key and the value).
45 @end deffn
46
47 \fassv
48 @c snarfed from alist.c:167
49 @deffn primitive assv key alist
50 Behaves like @code{assq} but uses @code{eqv?} for key comparison.
51 @end deffn
52
53 \fassoc
54 @c snarfed from alist.c:188
55 @deffn primitive assoc key alist
56 Behaves like @code{assq} but uses @code{equal?} for key comparison.
57 @end deffn
58
59 \fassq-ref
60 @c snarfed from alist.c:232
61 @deffn primitive assq-ref alist key
62 @deffnx primitive assv-ref alist key
63 @deffnx primitive assoc-ref alist key
64 Like @code{assq}, @code{assv} and @code{assoc}, except that only the
65 value associated with @var{key} in @var{alist} is returned. These
66 functions are equivalent to
67
68 @lisp
69 (let ((ent (@var{associator} @var{key} @var{alist})))
70 (and ent (cdr ent)))
71 @end lisp
72
73 where @var{associator} is one of @code{assq}, @code{assv} or @code{assoc}.
74 @end deffn
75
76 \fassv-ref
77 @c snarfed from alist.c:249
78 @deffn primitive assv-ref alist key
79 Behaves like @code{assq-ref} but uses @code{eqv?} for key comparison.
80 @end deffn
81
82 \fassoc-ref
83 @c snarfed from alist.c:266
84 @deffn primitive assoc-ref alist key
85 Behaves like @code{assq-ref} but uses @code{equal?} for key comparison.
86 @end deffn
87
88 \fassq-set!
89 @c snarfed from alist.c:295
90 @deffn primitive assq-set! alist key val
91 @deffnx primitive assv-set! alist key value
92 @deffnx primitive assoc-set! alist key value
93 Reassociate @var{key} in @var{alist} with @var{value}: find any existing
94 @var{alist} entry for @var{key} and associate it with the new
95 @var{value}. If @var{alist} does not contain an entry for @var{key},
96 add a new one. Return the (possibly new) alist.
97
98 These functions do not attempt to verify the structure of @var{alist},
99 and so may cause unusual results if passed an object that is not an
100 association list.
101 @end deffn
102
103 \fassv-set!
104 @c snarfed from alist.c:313
105 @deffn primitive assv-set! alist key val
106 Behaves like @code{assq-set!} but uses @code{eqv?} for key comparison.
107 @end deffn
108
109 \fassoc-set!
110 @c snarfed from alist.c:331
111 @deffn primitive assoc-set! alist key val
112 Behaves like @code{assq-set!} but uses @code{equal?} for key comparison.
113 @end deffn
114
115 \fassq-remove!
116 @c snarfed from alist.c:355
117 @deffn primitive assq-remove! alist key
118 @deffnx primitive assv-remove! alist key
119 @deffnx primitive assoc-remove! alist key
120 Delete the first entry in @var{alist} associated with @var{key}, and return
121 the resulting alist.
122 @end deffn
123
124 \fassv-remove!
125 @c snarfed from alist.c:371
126 @deffn primitive assv-remove! alist key
127 Behaves like @code{assq-remove!} but uses @code{eqv?} for key comparison.
128 @end deffn
129
130 \fassoc-remove!
131 @c snarfed from alist.c:387
132 @deffn primitive assoc-remove! alist key
133 Behaves like @code{assq-remove!} but uses @code{equal?} for key comparison.
134 @end deffn
135
136 \fmake-arbiter
137 @c snarfed from arbiters.c:84
138 @deffn primitive make-arbiter name
139 Return an object of type arbiter and name @var{name}. Its
140 state is initially unlocked. Arbiters are a way to achieve
141 process synchronization.
142 @end deffn
143
144 \ftry-arbiter
145 @c snarfed from arbiters.c:94
146 @deffn primitive try-arbiter arb
147 Return @code{#t} and lock the arbiter @var{arb} if the arbiter
148 was unlocked. Otherwise, return @code{#f}.
149 @end deffn
150
151 \frelease-arbiter
152 @c snarfed from arbiters.c:115
153 @deffn primitive release-arbiter arb
154 Return @code{#t} and unlock the arbiter @var{arb} if the
155 arbiter was locked. Otherwise, return @code{#f}.
156 @end deffn
157
158 \fasync
159 @c snarfed from async.c:290
160 @deffn primitive async thunk
161 Create a new async for the procedure @var{thunk}.
162 @end deffn
163
164 \fsystem-async
165 @c snarfed from async.c:300
166 @deffn primitive system-async thunk
167 Create a new async for the procedure @var{thunk}. Also
168 add it to the system's list of active async objects.
169 @end deffn
170
171 \fasync-mark
172 @c snarfed from async.c:317
173 @deffn primitive async-mark a
174 Mark the async @var{a} for future execution.
175 @end deffn
176
177 \fsystem-async-mark
178 @c snarfed from async.c:333
179 @deffn primitive system-async-mark a
180 Mark the async @var{a} for future execution.
181 @end deffn
182
183 \frun-asyncs
184 @c snarfed from async.c:353
185 @deffn primitive run-asyncs list_of_a
186 Execute all thunks from the asyncs of the list @var{list_of_a}.
187 @end deffn
188
189 \fnoop
190 @c snarfed from async.c:387
191 @deffn primitive noop . args
192 Do nothing. When called without arguments, return @code{#f},
193 otherwise return the first argument.
194 @end deffn
195
196 \funmask-signals
197 @c snarfed from async.c:439
198 @deffn primitive unmask-signals
199 Unmask signals. The returned value is not specified.
200 @end deffn
201
202 \fmask-signals
203 @c snarfed from async.c:450
204 @deffn primitive mask-signals
205 Mask signals. The returned value is not specified.
206 @end deffn
207
208 \fdisplay-error
209 @c snarfed from backtrace.c:262
210 @deffn primitive display-error stack port subr message args rest
211 Display an error message to the output port @var{port}.
212 @var{stack} is the saved stack for the error, @var{subr} is
213 the name of the procedure in which the error occured and
214 @var{message} is the actual error message, which may contain
215 formatting instructions. These will format the arguments in
216 the list @var{args} accordingly. @var{rest} is currently
217 ignored.
218 @end deffn
219
220 \fdisplay-application
221 @c snarfed from backtrace.c:399
222 @deffn primitive display-application frame [port [indent]]
223 Display a procedure application @var{frame} to the output port
224 @var{port}. @var{indent} specifies the indentation of the
225 output.
226 @end deffn
227
228 \fdisplay-backtrace
229 @c snarfed from backtrace.c:617
230 @deffn primitive display-backtrace stack port [first [depth]]
231 Display a backtrace to the output port @var{port}. @var{stack}
232 is the stack to take the backtrace from, @var{first} specifies
233 where in the stack to start and @var{depth} how much frames
234 to display. Both @var{first} and @var{depth} can be @code{#f},
235 which means that default values will be used.
236 @end deffn
237
238 \fbacktrace
239 @c snarfed from backtrace.c:640
240 @deffn primitive backtrace
241 Display a backtrace of the stack saved by the last error
242 to the current output port.
243 @end deffn
244
245 \fnot
246 @c snarfed from boolean.c:56
247 @deffn primitive not x
248 Return @code{#t} iff @var{x} is @code{#f}, else return @code{#f}.
249 @end deffn
250
251 \fboolean?
252 @c snarfed from boolean.c:66
253 @deffn primitive boolean? obj
254 Return @code{#t} iff @var{obj} is either @code{#t} or @code{#f}.
255 @end deffn
256
257 \fchar?
258 @c snarfed from chars.c:56
259 @deffn primitive char? x
260 Return @code{#t} iff @var{x} is a character, else @code{#f}.
261 @end deffn
262
263 \fchar=?
264 @c snarfed from chars.c:65
265 @deffn primitive char=? x y
266 Return @code{#t} iff @var{x} is the same character as @var{y}, else @code{#f}.
267 @end deffn
268
269 \fchar<?
270 @c snarfed from chars.c:78
271 @deffn primitive char<? x y
272 Return @code{#t} iff @var{x} is less than @var{y} in the ASCII sequence,
273 else @code{#f}.
274 @end deffn
275
276 \fchar<=?
277 @c snarfed from chars.c:90
278 @deffn primitive char<=? x y
279 Return @code{#t} iff @var{x} is less than or equal to @var{y} in the
280 ASCII sequence, else @code{#f}.
281 @end deffn
282
283 \fchar>?
284 @c snarfed from chars.c:102
285 @deffn primitive char>? x y
286 Return @code{#t} iff @var{x} is greater than @var{y} in the ASCII
287 sequence, else @code{#f}.
288 @end deffn
289
290 \fchar>=?
291 @c snarfed from chars.c:114
292 @deffn primitive char>=? x y
293 Return @code{#t} iff @var{x} is greater than or equal to @var{y} in the
294 ASCII sequence, else @code{#f}.
295 @end deffn
296
297 \fchar-ci=?
298 @c snarfed from chars.c:126
299 @deffn primitive char-ci=? x y
300 Return @code{#t} iff @var{x} is the same character as @var{y} ignoring
301 case, else @code{#f}.
302 @end deffn
303
304 \fchar-ci<?
305 @c snarfed from chars.c:138
306 @deffn primitive char-ci<? x y
307 Return @code{#t} iff @var{x} is less than @var{y} in the ASCII sequence
308 ignoring case, else @code{#f}.
309 @end deffn
310
311 \fchar-ci<=?
312 @c snarfed from chars.c:150
313 @deffn primitive char-ci<=? x y
314 Return @code{#t} iff @var{x} is less than or equal to @var{y} in the
315 ASCII sequence ignoring case, else @code{#f}.
316 @end deffn
317
318 \fchar-ci>?
319 @c snarfed from chars.c:162
320 @deffn primitive char-ci>? x y
321 Return @code{#t} iff @var{x} is greater than @var{y} in the ASCII
322 sequence ignoring case, else @code{#f}.
323 @end deffn
324
325 \fchar-ci>=?
326 @c snarfed from chars.c:174
327 @deffn primitive char-ci>=? x y
328 Return @code{#t} iff @var{x} is greater than or equal to @var{y} in the
329 ASCII sequence ignoring case, else @code{#f}.
330 @end deffn
331
332 \fchar-alphabetic?
333 @c snarfed from chars.c:187
334 @deffn primitive char-alphabetic? chr
335 Return @code{#t} iff @var{chr} is alphabetic, else @code{#f}.
336 Alphabetic means the same thing as the isalpha C library function.
337 @end deffn
338
339 \fchar-numeric?
340 @c snarfed from chars.c:198
341 @deffn primitive char-numeric? chr
342 Return @code{#t} iff @var{chr} is numeric, else @code{#f}.
343 Numeric means the same thing as the isdigit C library function.
344 @end deffn
345
346 \fchar-whitespace?
347 @c snarfed from chars.c:209
348 @deffn primitive char-whitespace? chr
349 Return @code{#t} iff @var{chr} is whitespace, else @code{#f}.
350 Whitespace means the same thing as the isspace C library function.
351 @end deffn
352
353 \fchar-upper-case?
354 @c snarfed from chars.c:222
355 @deffn primitive char-upper-case? chr
356 Return @code{#t} iff @var{chr} is uppercase, else @code{#f}.
357 Uppercase means the same thing as the isupper C library function.
358 @end deffn
359
360 \fchar-lower-case?
361 @c snarfed from chars.c:234
362 @deffn primitive char-lower-case? chr
363 Return @code{#t} iff @var{chr} is lowercase, else @code{#f}.
364 Lowercase means the same thing as the islower C library function.
365 @end deffn
366
367 \fchar-is-both?
368 @c snarfed from chars.c:248
369 @deffn primitive char-is-both? chr
370 Return @code{#t} iff @var{chr} is either uppercase or lowercase, else @code{#f}.
371 Uppercase and lowercase are as defined by the isupper and islower
372 C library functions.
373 @end deffn
374
375 \fchar->integer
376 @c snarfed from chars.c:262
377 @deffn primitive char->integer chr
378 Return the number corresponding to ordinal position of @var{chr} in the
379 ASCII sequence.
380 @end deffn
381
382 \finteger->char
383 @c snarfed from chars.c:274
384 @deffn primitive integer->char n
385 Return the character at position @var{n} in the ASCII sequence.
386 @end deffn
387
388 \fchar-upcase
389 @c snarfed from chars.c:285
390 @deffn primitive char-upcase chr
391 Return the uppercase character version of @var{chr}.
392 @end deffn
393
394 \fchar-downcase
395 @c snarfed from chars.c:296
396 @deffn primitive char-downcase chr
397 Return the lowercase character version of @var{chr}.
398 @end deffn
399
400 \fdebug-options-interface
401 @c snarfed from debug.c:80
402 @deffn primitive debug-options-interface [setting]
403 Option interface for the debug options. Instead of using
404 this procedure directly, use the procedures @code{debug-enable},
405 @code{debug-disable}, @code{debug-set!} and @var{debug-options}.
406 @end deffn
407
408 \fwith-traps
409 @c snarfed from debug.c:128
410 @deffn primitive with-traps thunk
411 Call @var{thunk} with traps enabled.
412 @end deffn
413
414 \fmemoized?
415 @c snarfed from debug.c:170
416 @deffn primitive memoized? obj
417 Return @code{#t} if @var{obj} is memoized.
418 @end deffn
419
420 \funmemoize
421 @c snarfed from debug.c:376
422 @deffn primitive unmemoize m
423 Unmemoize the memoized expression @var{m},
424 @end deffn
425
426 \fmemoized-environment
427 @c snarfed from debug.c:386
428 @deffn primitive memoized-environment m
429 Return the environment of the memoized expression @var{m}.
430 @end deffn
431
432 \fprocedure-name
433 @c snarfed from debug.c:396
434 @deffn primitive procedure-name proc
435 Return the name of the procedure @var{proc}
436 @end deffn
437
438 \fprocedure-source
439 @c snarfed from debug.c:422
440 @deffn primitive procedure-source proc
441 Return the source of the procedure @var{proc}.
442 @end deffn
443
444 \fprocedure-environment
445 @c snarfed from debug.c:456
446 @deffn primitive procedure-environment proc
447 Return the environment of the procedure @var{proc}.
448 @end deffn
449
450 \flocal-eval
451 @c snarfed from debug.c:488
452 @deffn primitive local-eval exp [env]
453 Evaluate @var{exp} in its environment. If @var{env} is supplied,
454 it is the environment in which to evaluate @var{exp}. Otherwise,
455 @var{exp} must be a memoized code object (in which case, its environment
456 is implicit).
457 @end deffn
458
459 \fdebug-object?
460 @c snarfed from debug.c:576
461 @deffn primitive debug-object? obj
462 Return @code{#t} if @var{obj} is a debug object.
463 @end deffn
464
465 \fc-registered-modules
466 @c snarfed from dynl.c:183
467 @deffn primitive c-registered-modules
468 Return a list of the object code modules that have been imported into
469 the current Guile process. Each element of the list is a pair whose
470 car is the name of the module, and whose cdr is the function handle
471 for that module's initializer function. The name is the string that
472 has been passed to scm_register_module_xxx.
473 @end deffn
474
475 \fc-clear-registered-modules
476 @c snarfed from dynl.c:204
477 @deffn primitive c-clear-registered-modules
478 Destroy the list of modules registered with the current Guile process.
479 The return value is unspecified. @strong{Warning:} this function does
480 not actually unlink or deallocate these modules, but only destroys the
481 records of which modules have been loaded. It should therefore be used
482 only by module bookkeeping operations.
483 @end deffn
484
485 \fdynamic-link
486 @c snarfed from dynl.c:356
487 @deffn primitive dynamic-link fname
488 Open the dynamic library @var{library-file}. A library handle
489 representing the opened library is returned; this handle should be used
490 as the @var{lib} argument to the following functions.
491 @end deffn
492
493 \fdynamic-object?
494 @c snarfed from dynl.c:372
495 @deffn primitive dynamic-object? obj
496 Return @code{#t} if @var{obj} is a dynamic library handle, or @code{#f}
497 otherwise.
498 @end deffn
499
500 \fdynamic-unlink
501 @c snarfed from dynl.c:388
502 @deffn primitive dynamic-unlink dobj
503 Unlink the library represented by @var{library-handle},
504 and remove any imported symbols from the address space.
505 GJB:FIXME:DOC: 2nd version below:
506 Unlink the indicated object file from the application. The
507 argument @var{dynobj} must have been obtained by a call to
508 @code{dynamic-link}. After @code{dynamic-unlink} has been
509 called on @var{dynobj}, its content is no longer accessible.
510 @end deffn
511
512 \fdynamic-func
513 @c snarfed from dynl.c:415
514 @deffn primitive dynamic-func name dobj
515 Search the dynamic object @var{dobj} for the C function
516 indicated by the string @var{name} and return some Scheme
517 handle that can later be used with @code{dynamic-call} to
518 actually call the function.
519
520 Regardless whether your C compiler prepends an underscore @samp{_} to
521 the global names in a program, you should @strong{not} include this
522 underscore in @var{function}. Guile knows whether the underscore is
523 needed or not and will add it when necessary.
524 @end deffn
525
526 \fdynamic-call
527 @c snarfed from dynl.c:460
528 @deffn primitive dynamic-call func dobj
529 Call @var{lib-thunk}, a procedure of no arguments. If @var{lib-thunk}
530 is a string, it is assumed to be a symbol found in the dynamic library
531 @var{lib} and is fetched with @code{dynamic-func}. Otherwise, it should
532 be a function handle returned by a previous call to @code{dynamic-func}.
533 The return value is unspecified.
534 GJB:FIXME:DOC 2nd version below
535 Call the C function indicated by @var{function} and @var{dynobj}. The
536 function is passed no arguments and its return value is ignored. When
537 @var{function} is something returned by @code{dynamic-func}, call that
538 function and ignore @var{dynobj}. When @var{function} is a string (or
539 symbol, etc.), look it up in @var{dynobj}; this is equivalent to
540
541 @smallexample
542 (dynamic-call (dynamic-func @var{function} @var{dynobj} #f))
543 @end smallexample
544
545 Interrupts are deferred while the C function is executing (with
546 @code{SCM_DEFER_INTS}/@code{SCM_ALLOW_INTS}).
547 @end deffn
548
549 \fdynamic-args-call
550 @c snarfed from dynl.c:494
551 @deffn primitive dynamic-args-call func dobj args
552 Call @var{proc}, a dynamically loaded function, passing it the argument
553 list @var{args} (a list of strings). As with @code{dynamic-call},
554 @var{proc} should be either a function handle or a string, in which case
555 it is first fetched from @var{lib} with @code{dynamic-func}.
556
557 @var{proc} is assumed to return an integer, which is used as the return
558 value from @code{dynamic-args-call}.
559
560 GJB:FIXME:DOC 2nd version below
561 Call the C function indicated by @var{function} and @var{dynobj}, just
562 like @code{dynamic-call}, but pass it some arguments and return its
563 return value. The C function is expected to take two arguments and
564 return an @code{int}, just like @code{main}:
565
566 @smallexample
567 int c_func (int argc, char **argv);
568 @end smallexample
569
570 The parameter @var{args} must be a list of strings and is converted into
571 an array of @code{char *}. The array is passed in @var{argv} and its
572 size in @var{argc}. The return value is converted to a Scheme number
573 and returned from the call to @code{dynamic-args-call}.
574 @end deffn
575
576 \fdynamic-wind
577 @c snarfed from dynwind.c:115
578 @deffn primitive dynamic-wind thunk1 thunk2 thunk3
579 All three arguments must be 0-argument procedures.
580
581 @var{in-guard} is called, then @var{thunk}, then @var{out-guard}.
582
583 If, any time during the execution of @var{thunk}, the continuation
584 of the @code{dynamic-wind} expression is escaped non-locally, @var{out-guard}
585 is called. If the continuation of the dynamic-wind is re-entered,
586 @var{in-guard} is called. Thus @var{in-guard} and @var{out-guard} may
587 be called any number of times.
588
589 @example
590 (define x 'normal-binding)
591 @result{} x
592
593 (define a-cont (call-with-current-continuation
594 (lambda (escape)
595 (let ((old-x x))
596 (dynamic-wind
597 ;; in-guard:
598 ;;
599 (lambda () (set! x 'special-binding))
600
601 ;; thunk
602 ;;
603 (lambda () (display x) (newline)
604 (call-with-current-continuation escape)
605 (display x) (newline)
606 x)
607
608 ;; out-guard:
609 ;;
610 (lambda () (set! x old-x)))))))
611
612 ;; Prints:
613 special-binding
614 ;; Evaluates to:
615 @result{} a-cont
616
617 x
618 @result{} normal-binding
619
620 (a-cont #f)
621 ;; Prints:
622 special-binding
623 ;; Evaluates to:
624 @result{} a-cont ;; the value of the (define a-cont...)
625
626 x
627 @result{} normal-binding
628
629 a-cont
630 @result{} special-binding
631 @end example
632 @end deffn
633
634 \fenvironment?
635 @c snarfed from environments.c:135
636 @deffn primitive environment? obj
637 Return @code{#t} if @var{obj} is an environment, or @code{#f}
638 otherwise.
639 @end deffn
640
641 \fenvironment-bound?
642 @c snarfed from environments.c:146
643 @deffn primitive environment-bound? env sym
644 Return @code{#t} if @var{sym} is bound in @var{env}, or
645 @code{#f} otherwise.
646 @end deffn
647
648 \fenvironment-ref
649 @c snarfed from environments.c:161
650 @deffn primitive environment-ref env sym
651 Return the value of the location bound to @var{sym} in
652 @var{env}. If @var{sym} is unbound in @var{env}, signal an
653 @code{environment:unbound} error.
654 @end deffn
655
656 \fenvironment-fold
657 @c snarfed from environments.c:231
658 @deffn primitive environment-fold env proc init
659 Iterate over all the bindings in @var{env}, accumulating some
660 value.
661 For each binding in @var{env}, apply @var{proc} to the symbol
662 bound, its value, and the result from the previous application
663 of @var{proc}.
664 Use @var{init} as @var{proc}'s third argument the first time
665 @var{proc} is applied.
666 If @var{env} contains no bindings, this function simply returns
667 @var{init}.
668 If @var{env} binds the symbol sym1 to the value val1, sym2 to
669 val2, and so on, then this procedure computes:
670 @example
671 (proc sym1 val1
672 (proc sym2 val2
673 ...
674 (proc symn valn
675 init)))
676 @end example
677 Each binding in @var{env} will be processed exactly once.
678 @code{environment-fold} makes no guarantees about the order in
679 which the bindings are processed.
680 Here is a function which, given an environment, constructs an
681 association list representing that environment's bindings,
682 using environment-fold:
683 @example
684 (define (environment->alist env)
685 (environment-fold env
686 (lambda (sym val tail)
687 (cons (cons sym val) tail))
688 '()))
689 @end example
690 @end deffn
691
692 \fenvironment-define
693 @c snarfed from environments.c:266
694 @deffn primitive environment-define env sym val
695 Bind @var{sym} to a new location containing @var{val} in
696 @var{env}. If @var{sym} is already bound to another location
697 in @var{env} and the binding is mutable, that binding is
698 replaced. The new binding and location are both mutable. The
699 return value is unspecified.
700 If @var{sym} is already bound in @var{env}, and the binding is
701 immutable, signal an @code{environment:immutable-binding} error.
702 @end deffn
703
704 \fenvironment-undefine
705 @c snarfed from environments.c:292
706 @deffn primitive environment-undefine env sym
707 Remove any binding for @var{sym} from @var{env}. If @var{sym}
708 is unbound in @var{env}, do nothing. The return value is
709 unspecified.
710 If @var{sym} is already bound in @var{env}, and the binding is
711 immutable, signal an @code{environment:immutable-binding} error.
712 @end deffn
713
714 \fenvironment-set!
715 @c snarfed from environments.c:320
716 @deffn primitive environment-set! env sym val
717 If @var{env} binds @var{sym} to some location, change that
718 location's value to @var{val}. The return value is
719 unspecified.
720 If @var{sym} is not bound in @var{env}, signal an
721 @code{environment:unbound} error. If @var{env} binds @var{sym}
722 to an immutable location, signal an
723 @code{environment:immutable-location} error.
724 @end deffn
725
726 \fenvironment-cell
727 @c snarfed from environments.c:355
728 @deffn primitive environment-cell env sym for_write
729 Return the value cell which @var{env} binds to @var{sym}, or
730 @code{#f} if the binding does not live in a value cell.
731 The argument @var{for-write} indicates whether the caller
732 intends to modify the variable's value by mutating the value
733 cell. If the variable is immutable, then
734 @code{environment-cell} signals an
735 @code{environment:immutable-location} error.
736 If @var{sym} is unbound in @var{env}, signal an
737 @code{environment:unbound} error.
738 If you use this function, you should consider using
739 @code{environment-observe}, to be notified when @var{sym} gets
740 re-bound to a new value cell, or becomes undefined.
741 @end deffn
742
743 \fenvironment-observe
744 @c snarfed from environments.c:407
745 @deffn primitive environment-observe env proc
746 Whenever @var{env}'s bindings change, apply @var{proc} to
747 @var{env}.
748 This function returns an object, token, which you can pass to
749 @code{environment-unobserve} to remove @var{proc} from the set
750 of procedures observing @var{env}. The type and value of
751 token is unspecified.
752 @end deffn
753
754 \fenvironment-observe-weak
755 @c snarfed from environments.c:424
756 @deffn primitive environment-observe-weak env proc
757 This function is the same as environment-observe, except that
758 the reference @var{env} retains to @var{proc} is a weak
759 reference. This means that, if there are no other live,
760 non-weak references to @var{proc}, it will be
761 garbage-collected, and dropped from @var{env}'s
762 list of observing procedures.
763 @end deffn
764
765 \fenvironment-unobserve
766 @c snarfed from environments.c:460
767 @deffn primitive environment-unobserve token
768 Cancel the observation request which returned the value
769 @var{token}. The return value is unspecified.
770 If a call @code{(environment-observe env proc)} returns
771 @var{token}, then the call @code{(environment-unobserve token)}
772 will cause @var{proc} to no longer be called when @var{env}'s
773 bindings change.
774 @end deffn
775
776 \fmake-leaf-environment
777 @c snarfed from environments.c:1040
778 @deffn primitive make-leaf-environment
779 Create a new leaf environment, containing no bindings.
780 All bindings and locations created in the new environment
781 will be mutable.
782 @end deffn
783
784 \fleaf-environment?
785 @c snarfed from environments.c:1063
786 @deffn primitive leaf-environment? object
787 Return @code{#t} if object is a leaf environment, or @code{#f}
788 otherwise.
789 @end deffn
790
791 \fmake-eval-environment
792 @c snarfed from environments.c:1429
793 @deffn primitive make-eval-environment local imported
794 Return a new environment object eval whose bindings are the
795 union of the bindings in the environments @var{local} and
796 @var{imported}, with bindings from @var{local} taking
797 precedence. Definitions made in eval are placed in @var{local}.
798 Applying @code{environment-define} or
799 @code{environment-undefine} to eval has the same effect as
800 applying the procedure to @var{local}.
801 Note that eval incorporates @var{local} and @var{imported} by
802 reference:
803 If, after creating eval, the program changes the bindings of
804 @var{local} or @var{imported}, those changes will be visible
805 in eval.
806 Since most Scheme evaluation takes place in eval environments,
807 they transparently cache the bindings received from @var{local}
808 and @var{imported}. Thus, the first time the program looks up
809 a symbol in eval, eval may make calls to @var{local} or
810 @var{imported} to find their bindings, but subsequent
811 references to that symbol will be as fast as references to
812 bindings in finite environments.
813 In typical use, @var{local} will be a finite environment, and
814 @var{imported} will be an import environment
815 @end deffn
816
817 \feval-environment?
818 @c snarfed from environments.c:1466
819 @deffn primitive eval-environment? object
820 Return @code{#t} if object is an eval environment, or @code{#f}
821 otherwise.
822 @end deffn
823
824 \feval-environment-local
825 @c snarfed from environments.c:1476
826 @deffn primitive eval-environment-local env
827 Return the local environment of eval environment @var{env}.
828 @end deffn
829
830 \feval-environment-set-local!
831 @c snarfed from environments.c:1488
832 @deffn primitive eval-environment-set-local! env local
833 Change @var{env}'s local environment to @var{local}.
834 @end deffn
835
836 \feval-environment-imported
837 @c snarfed from environments.c:1514
838 @deffn primitive eval-environment-imported env
839 Return the imported environment of eval environment @var{env}.
840 @end deffn
841
842 \feval-environment-set-imported!
843 @c snarfed from environments.c:1526
844 @deffn primitive eval-environment-set-imported! env imported
845 Change @var{env}'s imported environment to @var{imported}.
846 @end deffn
847
848 \fmake-import-environment
849 @c snarfed from environments.c:1846
850 @deffn primitive make-import-environment imports conflict_proc
851 Return a new environment @var{imp} whose bindings are the union
852 of the bindings from the environments in @var{imports};
853 @var{imports} must be a list of environments. That is,
854 @var{imp} binds a symbol to a location when some element of
855 @var{imports} does.
856 If two different elements of @var{imports} have a binding for
857 the same symbol, the @var{conflict-proc} is called with the
858 following parameters: the import environment, the symbol and
859 the list of the imported environments that bind the symbol.
860 If the @var{conflict-proc} returns an environment @var{env},
861 the conflict is considered as resolved and the binding from
862 @var{env} is used. If the @var{conflict-proc} returns some
863 non-environment object, the conflict is considered unresolved
864 and the symbol is treated as unspecified in the import
865 environment.
866 The checking for conflicts may be performed lazily, i. e. at
867 the moment when a value or binding for a certain symbol is
868 requested instead of the moment when the environment is
869 created or the bindings of the imports change.
870 All bindings in @var{imp} are immutable. If you apply
871 @code{environment-define} or @code{environment-undefine} to
872 @var{imp}, Guile will signal an
873 @code{environment:immutable-binding} error. However,
874 notice that the set of bindings in @var{imp} may still change,
875 if one of its imported environments changes.
876 @end deffn
877
878 \fimport-environment?
879 @c snarfed from environments.c:1875
880 @deffn primitive import-environment? object
881 Return @code{#t} if object is an import environment, or
882 @code{#f} otherwise.
883 @end deffn
884
885 \fimport-environment-imports
886 @c snarfed from environments.c:1886
887 @deffn primitive import-environment-imports env
888 Return the list of environments imported by the import
889 environment @var{env}.
890 @end deffn
891
892 \fimport-environment-set-imports!
893 @c snarfed from environments.c:1899
894 @deffn primitive import-environment-set-imports! env imports
895 Change @var{env}'s list of imported environments to
896 @var{imports}, and check for conflicts.
897 @end deffn
898
899 \fmake-export-environment
900 @c snarfed from environments.c:2164
901 @deffn primitive make-export-environment private signature
902 Return a new environment @var{exp} containing only those
903 bindings in private whose symbols are present in
904 @var{signature}. The @var{private} argument must be an
905 environment.
906
907 The environment @var{exp} binds symbol to location when
908 @var{env} does, and symbol is exported by @var{signature}.
909
910 @var{signature} is a list specifying which of the bindings in
911 @var{private} should be visible in @var{exp}. Each element of
912 @var{signature} should be a list of the form:
913 (symbol attribute ...)
914 where each attribute is one of the following:
915 @table @asis
916 @item the symbol @code{mutable-location}
917 @var{exp} should treat the
918 location bound to symbol as mutable. That is, @var{exp}
919 will pass calls to @code{environment-set!} or
920 @code{environment-cell} directly through to private.
921 @item the symbol @code{immutable-location}
922 @var{exp} should treat
923 the location bound to symbol as immutable. If the program
924 applies @code{environment-set!} to @var{exp} and symbol, or
925 calls @code{environment-cell} to obtain a writable value
926 cell, @code{environment-set!} will signal an
927 @code{environment:immutable-location} error. Note that, even
928 if an export environment treats a location as immutable, the
929 underlying environment may treat it as mutable, so its
930 value may change.
931 @end table
932 It is an error for an element of signature to specify both
933 @code{mutable-location} and @code{immutable-location}. If
934 neither is specified, @code{immutable-location} is assumed.
935
936 As a special case, if an element of signature is a lone
937 symbol @var{sym}, it is equivalent to an element of the form
938 @code{(sym)}.
939
940 All bindings in @var{exp} are immutable. If you apply
941 @code{environment-define} or @code{environment-undefine} to
942 @var{exp}, Guile will signal an
943 @code{environment:immutable-binding} error. However,
944 notice that the set of bindings in @var{exp} may still change,
945 if the bindings in private change.
946 @end deffn
947
948 \fexport-environment?
949 @c snarfed from environments.c:2199
950 @deffn primitive export-environment? object
951 Return @code{#t} if object is an export environment, or
952 @code{#f} otherwise.
953 @end deffn
954
955 \fexport-environment-private
956 @c snarfed from environments.c:2209
957 @deffn primitive export-environment-private env
958 Return the private environment of export environment @var{env}.
959 @end deffn
960
961 \fexport-environment-set-private!
962 @c snarfed from environments.c:2221
963 @deffn primitive export-environment-set-private! env private
964 Change the private environment of export environment @var{env}.
965 @end deffn
966
967 \fexport-environment-signature
968 @c snarfed from environments.c:2243
969 @deffn primitive export-environment-signature env
970 Return the signature of export environment @var{env}.
971 @end deffn
972
973 \fexport-environment-set-signature!
974 @c snarfed from environments.c:2317
975 @deffn primitive export-environment-set-signature! env signature
976 Change the signature of export environment @var{env}.
977 @end deffn
978
979 \feq?
980 @c snarfed from eq.c:64
981 @deffn primitive eq? x y
982 Return @code{#t} iff @var{x} references the same object as @var{y}.
983 @code{eq?} is similar to @code{eqv?} except that in some cases it is
984 capable of discerning distinctions finer than those detectable by
985 @code{eqv?}.
986 @end deffn
987
988 \feqv?
989 @c snarfed from eq.c:78
990 @deffn primitive eqv? x y
991 The @code{eqv?} procedure defines a useful equivalence relation on objects.
992 Briefly, it returns @code{#t} if @var{x} and @var{y} should normally be
993 regarded as the same object. This relation is left slightly open to
994 interpretation, but works for comparing immediate integers, characters,
995 and inexact numbers.
996 @end deffn
997
998 \fequal?
999 @c snarfed from eq.c:127
1000 @deffn primitive equal? x y
1001 Return @code{#t} iff @var{x} and @var{y} are recursively @code{eqv?} equivalent.
1002 @code{equal?} recursively compares the contents of pairs,
1003 vectors, and strings, applying @code{eqv?} on other objects such as
1004 numbers and symbols. A rule of thumb is that objects are generally
1005 @code{equal?} if they print the same. @code{equal?} may fail to
1006 terminate if its arguments are circular data structures.
1007 @end deffn
1008
1009 \fscm-error
1010 @c snarfed from error.c:112
1011 @deffn primitive scm-error key subr message args rest
1012 Raise an error with key @var{key}. @var{subr} can be a string naming
1013 the procedure associated with the error, or @code{#f}. @var{message}
1014 is the error message string, possibly containing @code{~S} and @code{~A}
1015 escapes. When an error is reported, these are replaced by formating the
1016 corresponding members of @var{args}: @code{~A} (was @code{%s}) formats using @code{display}
1017 and @code{~S} (was @code{%S}) formats using @code{write}. @var{data} is a
1018 list or @code{#f} depending on @var{key}: if @var{key} is
1019 @code{system-error} then it should be a list
1020 containing the Unix @code{errno} value; If @var{key} is @code{signal} then
1021 it should be a list containing the Unix signal number; otherwise it
1022 will usually be @code{#f}.
1023 @end deffn
1024
1025 \fstrerror
1026 @c snarfed from error.c:153
1027 @deffn primitive strerror err
1028 Returns the Unix error message corresponding to @var{err}, an integer.
1029 @end deffn
1030
1031 \fapply:nconc2last
1032 @c snarfed from eval.c:3221
1033 @deffn primitive apply:nconc2last lst
1034 Given a list (@var{arg1} @dots{} @var{args}), this function
1035 conses the @var{arg1} @dots{} arguments onto the front of
1036 @var{args}, and returns the resulting list. Note that
1037 @var{args} is a list; thus, the argument to this function is
1038 a list whose last element is a list.
1039 Note: Rather than do new consing, @code{apply:nconc2last}
1040 destroys its argument, so use with care.
1041 @end deffn
1042
1043 \fforce
1044 @c snarfed from eval.c:3754
1045 @deffn primitive force x
1046 If the promise @var{x} has not been computed yet, compute and
1047 return @var{x}, otherwise just return the previously computed
1048 value.
1049 @end deffn
1050
1051 \fpromise?
1052 @c snarfed from eval.c:3777
1053 @deffn primitive promise? obj
1054 Return true if @var{obj} is a promise, i.e. a delayed computation
1055 (@pxref{Delayed evaluation,,,r4rs.info,The Revised^4 Report on Scheme}).
1056 @end deffn
1057
1058 \fcons-source
1059 @c snarfed from eval.c:3789
1060 @deffn primitive cons-source xorig x y
1061 Create and return a new pair whose car and cdr are @var{x} and @var{y}.
1062 Any source properties associated with @var{xorig} are also associated
1063 with the new pair.
1064 @end deffn
1065
1066 \fcopy-tree
1067 @c snarfed from eval.c:3811
1068 @deffn primitive copy-tree obj
1069 Recursively copy the data tree that is bound to @var{obj}, and return a
1070 pointer to the new data structure. @code{copy-tree} recurses down the
1071 contents of both pairs and vectors (since both cons cells and vector
1072 cells may point to arbitrary objects), and stops recursing when it hits
1073 any other object.
1074 @end deffn
1075
1076 \fprimitive-eval
1077 @c snarfed from eval.c:3912
1078 @deffn primitive primitive-eval exp
1079 Evaluate @var{exp} in the top-level environment specified by
1080 the current module.
1081 @end deffn
1082
1083 \feval
1084 @c snarfed from eval.c:3977
1085 @deffn primitive eval exp module
1086 Evaluate @var{exp}, a list representing a Scheme expression,
1087 in the top-level environment specified by @var{module}.
1088 While @var{exp} is evaluated (using @var{primitive-eval}),
1089 @var{module} is made the current module. The current module
1090 is reset to its previous value when @var{eval} returns.
1091 @end deffn
1092
1093 \feval2
1094 @c snarfed from eval.c:4020
1095 @deffn primitive eval2 obj env_thunk
1096 Evaluate @var{exp}, a Scheme expression, in the environment
1097 designated by @var{lookup}, a symbol-lookup function."
1098 Do not use this version of eval, it does not play well
1099 with the module system. Use @code{eval} or
1100 @code{primitive-eval} instead.
1101 @end deffn
1102
1103 \feval-options-interface
1104 @c snarfed from eval.c:1685
1105 @deffn primitive eval-options-interface [setting]
1106 Option interface for the evaluation options. Instead of using
1107 this procedure directly, use the procedures @code{eval-enable},
1108 @code{eval-disable}, @code{eval-set!} and @var{eval-options}.
1109 @end deffn
1110
1111 \fevaluator-traps-interface
1112 @c snarfed from eval.c:1702
1113 @deffn primitive evaluator-traps-interface [setting]
1114 Option interface for the evaluator trap options.
1115 @end deffn
1116
1117 \fdefined?
1118 @c snarfed from evalext.c:74
1119 @deffn primitive defined? sym [env]
1120 Return @code{#t} if @var{sym} is defined in the top-level environment.
1121 @end deffn
1122
1123 \fmap-in-order
1124 @c snarfed from evalext.c:146
1125 @deffn primitive map-in-order
1126 scm_map
1127 @end deffn
1128
1129 \fprogram-arguments
1130 @c snarfed from feature.c:79
1131 @deffn primitive program-arguments
1132 @deffnx procedure command-line
1133 Return the list of command line arguments passed to Guile, as a list of
1134 strings. The list includes the invoked program name, which is usually
1135 @code{"guile"}, but excludes switches and parameters for command line
1136 options like @code{-e} and @code{-l}.
1137 @end deffn
1138
1139 \fchown
1140 @c snarfed from filesys.c:140
1141 @deffn primitive chown object owner group
1142 Change the ownership and group of the file referred to by @var{object} to
1143 the integer values @var{owner} and @var{group}. @var{object} can be
1144 a string containing a file name or, if the platform
1145 supports fchown, a port or integer file descriptor
1146 which is open on the file. The return value
1147 is unspecified.
1148
1149 If @var{object} is a symbolic link, either the
1150 ownership of the link or the ownership of the referenced file will be
1151 changed depending on the operating system (lchown is
1152 unsupported at present). If @var{owner} or @var{group} is specified
1153 as @code{-1}, then that ID is not changed.
1154 @end deffn
1155
1156 \fchmod
1157 @c snarfed from filesys.c:180
1158 @deffn primitive chmod object mode
1159 Changes the permissions of the file referred to by @var{obj}.
1160 @var{obj} can be a string containing a file name or a port or integer file
1161 descriptor which is open on a file (in which case @code{fchmod} is used
1162 as the underlying system call).
1163 @var{mode} specifies
1164 the new permissions as a decimal number, e.g., @code{(chmod "foo" #o755)}.
1165 The return value is unspecified.
1166 @end deffn
1167
1168 \fumask
1169 @c snarfed from filesys.c:214
1170 @deffn primitive umask [mode]
1171 If @var{mode} is omitted, retuns a decimal number representing the current
1172 file creation mask. Otherwise the file creation mask is set to
1173 @var{mode} and the previous value is returned.
1174
1175 E.g., @code{(umask #o022)} sets the mask to octal 22, decimal 18.
1176 @end deffn
1177
1178 \fopen-fdes
1179 @c snarfed from filesys.c:237
1180 @deffn primitive open-fdes path flags [mode]
1181 Similar to @code{open} but returns a file descriptor instead of a
1182 port.
1183 @end deffn
1184
1185 \fopen
1186 @c snarfed from filesys.c:280
1187 @deffn primitive open path flags [mode]
1188 Open the file named by @var{path} for reading and/or writing.
1189 @var{flags} is an integer specifying how the file should be opened.
1190 @var{mode} is an integer specifying the permission bits of the file, if
1191 it needs to be created, before the umask is applied. The default is 666
1192 (Unix itself has no default).
1193
1194 @var{flags} can be constructed by combining variables using @code{logior}.
1195 Basic flags are:
1196
1197 @defvar O_RDONLY
1198 Open the file read-only.
1199 @end defvar
1200 @defvar O_WRONLY
1201 Open the file write-only.
1202 @end defvar
1203 @defvar O_RDWR
1204 Open the file read/write.
1205 @end defvar
1206 @defvar O_APPEND
1207 Append to the file instead of truncating.
1208 @end defvar
1209 @defvar O_CREAT
1210 Create the file if it does not already exist.
1211 @end defvar
1212
1213 See the Unix documentation of the @code{open} system call
1214 for additional flags.
1215 @end deffn
1216
1217 \fclose
1218 @c snarfed from filesys.c:318
1219 @deffn primitive close fd_or_port
1220 Similar to close-port (@pxref{Generic Port Operations, close-port}),
1221 but also works on file descriptors. A side
1222 effect of closing a file descriptor is that any ports using that file
1223 descriptor are moved to a different file descriptor and have
1224 their revealed counts set to zero.
1225 @end deffn
1226
1227 \fclose-fdes
1228 @c snarfed from filesys.c:346
1229 @deffn primitive close-fdes fd
1230 A simple wrapper for the @code{close} system call.
1231 Close file descriptor @var{fd}, which must be an integer.
1232 Unlike close (@pxref{Ports and File Descriptors, close}),
1233 the file descriptor will be closed even if a port is using it.
1234 The return value is unspecified.
1235 @end deffn
1236
1237 \fstat
1238 @c snarfed from filesys.c:518
1239 @deffn primitive stat object
1240 Returns an object containing various information
1241 about the file determined by @var{obj}.
1242 @var{obj} can be a string containing a file name or a port or integer file
1243 descriptor which is open on a file (in which case @code{fstat} is used
1244 as the underlying system call).
1245
1246 The object returned by @code{stat} can be passed as a single parameter
1247 to the following procedures, all of which return integers:
1248
1249 @table @code
1250 @item stat:dev
1251 The device containing the file.
1252 @item stat:ino
1253 The file serial number, which distinguishes this file from all other
1254 files on the same device.
1255 @item stat:mode
1256 The mode of the file. This includes file type information
1257 and the file permission bits. See @code{stat:type} and @code{stat:perms}
1258 below.
1259 @item stat:nlink
1260 The number of hard links to the file.
1261 @item stat:uid
1262 The user ID of the file's owner.
1263 @item stat:gid
1264 The group ID of the file.
1265 @item stat:rdev
1266 Device ID; this entry is defined only for character or block
1267 special files.
1268 @item stat:size
1269 The size of a regular file in bytes.
1270 @item stat:atime
1271 The last access time for the file.
1272 @item stat:mtime
1273 The last modification time for the file.
1274 @item stat:ctime
1275 The last modification time for the attributes of the file.
1276 @item stat:blksize
1277 The optimal block size for reading or writing the file, in bytes.
1278 @item stat:blocks
1279 The amount of disk space that the file occupies measured in units of
1280 512 byte blocks.
1281 @end table
1282
1283 In addition, the following procedures return the information
1284 from stat:mode in a more convenient form:
1285
1286 @table @code
1287 @item stat:type
1288 A symbol representing the type of file. Possible values are
1289 regular, directory, symlink, block-special, char-special,
1290 fifo, socket and unknown
1291 @item stat:perms
1292 An integer representing the access permission bits.
1293 @end table
1294 @end deffn
1295
1296 \flink
1297 @c snarfed from filesys.c:564
1298 @deffn primitive link oldpath newpath
1299 Creates a new name @var{newpath} in the file system for the
1300 file named by @var{oldpath}. If @var{oldpath} is a symbolic
1301 link, the link may or may not be followed depending on the
1302 system.
1303 @end deffn
1304
1305 \frename-file
1306 @c snarfed from filesys.c:586
1307 @deffn primitive rename-file oldname newname
1308 Renames the file specified by @var{oldname} to @var{newname}.
1309 The return value is unspecified.
1310 @end deffn
1311
1312 \fdelete-file
1313 @c snarfed from filesys.c:615
1314 @deffn primitive delete-file str
1315 Deletes (or "unlinks") the file specified by @var{path}.
1316 @end deffn
1317
1318 \fmkdir
1319 @c snarfed from filesys.c:634
1320 @deffn primitive mkdir path [mode]
1321 Create a new directory named by @var{path}. If @var{mode} is omitted
1322 then the permissions of the directory file are set using the current
1323 umask. Otherwise they are set to the decimal value specified with
1324 @var{mode}. The return value is unspecified.
1325 @end deffn
1326
1327 \frmdir
1328 @c snarfed from filesys.c:663
1329 @deffn primitive rmdir path
1330 Remove the existing directory named by @var{path}. The directory must
1331 be empty for this to succeed. The return value is unspecified.
1332 @end deffn
1333
1334 \fdirectory-stream?
1335 @c snarfed from filesys.c:689
1336 @deffn primitive directory-stream? obj
1337 Returns a boolean indicating whether @var{object} is a directory stream
1338 as returned by @code{opendir}.
1339 @end deffn
1340
1341 \fopendir
1342 @c snarfed from filesys.c:700
1343 @deffn primitive opendir dirname
1344 Open the directory specified by @var{path} and return a directory
1345 stream.
1346 @end deffn
1347
1348 \freaddir
1349 @c snarfed from filesys.c:718
1350 @deffn primitive readdir port
1351 Return (as a string) the next directory entry from the directory stream
1352 @var{stream}. If there is no remaining entry to be read then the
1353 end of file object is returned.
1354 @end deffn
1355
1356 \frewinddir
1357 @c snarfed from filesys.c:741
1358 @deffn primitive rewinddir port
1359 Reset the directory port @var{stream} so that the next call to
1360 @code{readdir} will return the first directory entry.
1361 @end deffn
1362
1363 \fclosedir
1364 @c snarfed from filesys.c:758
1365 @deffn primitive closedir port
1366 Close the directory stream @var{stream}.
1367 The return value is unspecified.
1368 @end deffn
1369
1370 \fchdir
1371 @c snarfed from filesys.c:808
1372 @deffn primitive chdir str
1373 Change the current working directory to @var{path}.
1374 The return value is unspecified.
1375 @end deffn
1376
1377 \fgetcwd
1378 @c snarfed from filesys.c:825
1379 @deffn primitive getcwd
1380 Returns the name of the current working directory.
1381 @end deffn
1382
1383 \fselect
1384 @c snarfed from filesys.c:1022
1385 @deffn primitive select reads writes excepts [secs [usecs]]
1386 This procedure has a variety of uses: waiting for the ability
1387 to provide input, accept output, or the existance of
1388 exceptional conditions on a collection of ports or file
1389 descriptors, or waiting for a timeout to occur.
1390 It also returns if interrupted by a signal.
1391
1392 @var{reads}, @var{writes} and @var{excepts} can be lists or
1393 vectors, with each member a port or a file descriptor.
1394 The value returned is a list of three corresponding
1395 lists or vectors containing only the members which meet the
1396 specified requirement. The ability of port buffers to
1397 provide input or accept output is taken into account.
1398 Ordering of the input lists or vectors is not preserved.
1399
1400 The optional arguments @var{secs} and @var{usecs} specify the
1401 timeout. Either @var{secs} can be specified alone, as
1402 either an integer or a real number, or both @var{secs} and
1403 @var{usecs} can be specified as integers, in which case
1404 @var{usecs} is an additional timeout expressed in
1405 microseconds. If @var{secs} is omitted or is @code{#f} then
1406 select will wait for as long as it takes for one of the other
1407 conditions to be satisfied.
1408
1409 The scsh version of @code{select} differs as follows:
1410 Only vectors are accepted for the first three arguments.
1411 The @var{usecs} argument is not supported.
1412 Multiple values are returned instead of a list.
1413 Duplicates in the input vectors appear only once in output.
1414 An additional @code{select!} interface is provided.
1415 @end deffn
1416
1417 \ffcntl
1418 @c snarfed from filesys.c:1167
1419 @deffn primitive fcntl object cmd [value]
1420 Apply @var{command} to the specified file descriptor or the underlying
1421 file descriptor of the specified port. @var{value} is an optional
1422 integer argument.
1423
1424 Values for @var{command} are:
1425
1426 @table @code
1427 @item F_DUPFD
1428 Duplicate a file descriptor
1429 @item F_GETFD
1430 Get flags associated with the file descriptor.
1431 @item F_SETFD
1432 Set flags associated with the file descriptor to @var{value}.
1433 @item F_GETFL
1434 Get flags associated with the open file.
1435 @item F_SETFL
1436 Set flags associated with the open file to @var{value}
1437 @item F_GETOWN
1438 Get the process ID of a socket's owner, for @code{SIGIO} signals.
1439 @item F_SETOWN
1440 Set the process that owns a socket to @var{value}, for @code{SIGIO} signals.
1441 @item FD_CLOEXEC
1442 The value used to indicate the "close on exec" flag with @code{F_GETFL} or
1443 @code{F_SETFL}.
1444 @end table
1445 @end deffn
1446
1447 \ffsync
1448 @c snarfed from filesys.c:1203
1449 @deffn primitive fsync object
1450 Copies any unwritten data for the specified output file descriptor to disk.
1451 If @var{port/fd} is a port, its buffer is flushed before the underlying
1452 file descriptor is fsync'd.
1453 The return value is unspecified.
1454 @end deffn
1455
1456 \fsymlink
1457 @c snarfed from filesys.c:1230
1458 @deffn primitive symlink oldpath newpath
1459 Create a symbolic link named @var{path-to} with the value (i.e., pointing to)
1460 @var{path-from}. The return value is unspecified.
1461 @end deffn
1462
1463 \freadlink
1464 @c snarfed from filesys.c:1252
1465 @deffn primitive readlink path
1466 Returns the value of the symbolic link named by
1467 @var{path} (a string), i.e., the
1468 file that the link points to.
1469 @end deffn
1470
1471 \flstat
1472 @c snarfed from filesys.c:1282
1473 @deffn primitive lstat str
1474 Similar to @code{stat}, but does not follow symbolic links, i.e.,
1475 it will return information about a symbolic link itself, not the
1476 file it points to. @var{path} must be a string.
1477 @end deffn
1478
1479 \fcopy-file
1480 @c snarfed from filesys.c:1307
1481 @deffn primitive copy-file oldfile newfile
1482 Copy the file specified by @var{path-from} to @var{path-to}.
1483 The return value is unspecified.
1484 @end deffn
1485
1486 \fdirname
1487 @c snarfed from filesys.c:1354
1488 @deffn primitive dirname filename
1489 Return the directory name component of the file name
1490 @var{filename}. If @var{filename} does not contain a directory
1491 component, @code{.} is returned.
1492 @end deffn
1493
1494 \fbasename
1495 @c snarfed from filesys.c:1387
1496 @deffn primitive basename filename [suffix]
1497 Return the base name of the file name @var{filename}. The
1498 base name is the file name without any directory components.
1499 If @var{suffix} is privided, and is equal to the end of
1500 @var{basename}, it is removed also.
1501 @end deffn
1502
1503 \fmake-fluid
1504 @c snarfed from fluids.c:128
1505 @deffn primitive make-fluid
1506 Return a newly created fluid.
1507 Fluids are objects of a certain type (a smob) that can hold one SCM
1508 value per dynamic root. That is, modifications to this value are
1509 only visible to code that executes within the same dynamic root as
1510 the modifying code. When a new dynamic root is constructed, it
1511 inherits the values from its parent. Because each thread executes
1512 in its own dynamic root, you can use fluids for thread local storage.
1513 @end deffn
1514
1515 \ffluid?
1516 @c snarfed from fluids.c:141
1517 @deffn primitive fluid? obj
1518 Return #t iff @var{obj} is a fluid; otherwise, return #f.
1519 @end deffn
1520
1521 \ffluid-ref
1522 @c snarfed from fluids.c:151
1523 @deffn primitive fluid-ref fluid
1524 Return the value associated with @var{fluid} in the current dynamic root.
1525 If @var{fluid} has not been set, then this returns #f.
1526 @end deffn
1527
1528 \ffluid-set!
1529 @c snarfed from fluids.c:168
1530 @deffn primitive fluid-set! fluid value
1531 Set the value associated with @var{fluid} in the current dynamic root.
1532 @end deffn
1533
1534 \fwith-fluids*
1535 @c snarfed from fluids.c:227
1536 @deffn primitive with-fluids* fluids values thunk
1537 Set @var{fluids} to @var{values} temporary, and call @var{thunk}.
1538 @var{fluids} must be a list of fluids and @var{values} must be the same
1539 number of their values to be applied. Each substitution is done
1540 one after another. @var{thunk} must be a procedure with no argument.
1541 @end deffn
1542
1543 \fsetvbuf
1544 @c snarfed from fports.c:148
1545 @deffn primitive setvbuf port mode [size]
1546 Set the buffering mode for @var{port}. @var{mode} can be:
1547 @table @code
1548 @item _IONBF
1549 non-buffered
1550 @item _IOLBF
1551 line buffered
1552 @item _IOFBF
1553 block buffered, using a newly allocated buffer of @var{size} bytes.
1554 If @var{size} is omitted, a default size will be used.
1555 @end table
1556 @end deffn
1557
1558 \ffile-port?
1559 @c snarfed from fports.c:229
1560 @deffn primitive file-port? obj
1561 Determine whether @var{obj} is a port that is related to a file.
1562 @end deffn
1563
1564 \fopen-file
1565 @c snarfed from fports.c:282
1566 @deffn primitive open-file filename modes
1567 Open the file whose name is @var{string}, and return a port
1568 representing that file. The attributes of the port are
1569 determined by the @var{mode} string. The way in
1570 which this is interpreted is similar to C stdio:
1571
1572 The first character must be one of the following:
1573
1574 @table @samp
1575 @item r
1576 Open an existing file for input.
1577 @item w
1578 Open a file for output, creating it if it doesn't already exist
1579 or removing its contents if it does.
1580 @item a
1581 Open a file for output, creating it if it doesn't already exist.
1582 All writes to the port will go to the end of the file.
1583 The "append mode" can be turned off while the port is in use
1584 @pxref{Ports and File Descriptors, fcntl}
1585 @end table
1586
1587 The following additional characters can be appended:
1588
1589 @table @samp
1590 @item +
1591 Open the port for both input and output. E.g., @code{r+}: open
1592 an existing file for both input and output.
1593 @item 0
1594 Create an "unbuffered" port. In this case input and output operations
1595 are passed directly to the underlying port implementation without
1596 additional buffering. This is likely to slow down I/O operations.
1597 The buffering mode can be changed while a port is in use
1598 @pxref{Ports and File Descriptors, setvbuf}
1599 @item l
1600 Add line-buffering to the port. The port output buffer will be
1601 automatically flushed whenever a newline character is written.
1602 @end table
1603
1604 In theory we could create read/write ports which were buffered in one
1605 direction only. However this isn't included in the current interfaces.
1606
1607 If a file cannot be opened with the access requested,
1608 @code{open-file} throws an exception.
1609 @end deffn
1610
1611 \fgc-stats
1612 @c snarfed from gc.c:742
1613 @deffn primitive gc-stats
1614 Returns an association list of statistics about Guile's current use of storage.
1615 @end deffn
1616
1617 \fobject-address
1618 @c snarfed from gc.c:839
1619 @deffn primitive object-address obj
1620 Return an integer that for the lifetime of @var{obj} is uniquely
1621 returned by this function for @var{obj}
1622 @end deffn
1623
1624 \fgc
1625 @c snarfed from gc.c:850
1626 @deffn primitive gc
1627 Scans all of SCM objects and reclaims for further use those that are
1628 no longer accessible.
1629 @end deffn
1630
1631 \funhash-name
1632 @c snarfed from gc.c:2291
1633 @deffn primitive unhash-name name
1634 Flushes the glocs for @var{name}, or all glocs if @var{name}
1635 is @code{#t}.
1636 @end deffn
1637
1638 \f%compute-slots
1639 @c snarfed from goops.c:290
1640 @deffn primitive %compute-slots class
1641 Return a list consisting of the names of all slots belonging to
1642 class @var{class}, i. e. the slots of @var{class} and of all of
1643 its superclasses.
1644 @end deffn
1645
1646 \fget-keyword
1647 @c snarfed from goops.c:375
1648 @deffn primitive get-keyword key l default_value
1649 Determine an associated value for the keyword @var{key} from
1650 the list @var{l}. The list @var{l} has to consist of an even
1651 number of elements, where, starting with the first, every
1652 second element is a keyword, followed by its associated value.
1653 If @var{l} does not hold a value for @var{key}, the value
1654 @var{default_value} is returned.
1655 @end deffn
1656
1657 \f%initialize-object
1658 @c snarfed from goops.c:398
1659 @deffn primitive %initialize-object obj initargs
1660 Initialize the object @var{obj} with the given arguments
1661 @var{initargs}.
1662 @end deffn
1663
1664 \f%prep-layout!
1665 @c snarfed from goops.c:479
1666 @deffn primitive %prep-layout! class
1667 @end deffn
1668
1669 \f%inherit-magic!
1670 @c snarfed from goops.c:542
1671 @deffn primitive %inherit-magic! class dsupers
1672 @end deffn
1673
1674 \finstance?
1675 @c snarfed from goops.c:783
1676 @deffn primitive instance? obj
1677 Return @code{#t} if @var{obj} is an instance.
1678 @end deffn
1679
1680 \fclass-name
1681 @c snarfed from goops.c:798
1682 @deffn primitive class-name obj
1683 Return the class name of @var{obj}.
1684 @end deffn
1685
1686 \fclass-direct-supers
1687 @c snarfed from goops.c:808
1688 @deffn primitive class-direct-supers obj
1689 Return the direct superclasses of the class @var{obj}.
1690 @end deffn
1691
1692 \fclass-direct-slots
1693 @c snarfed from goops.c:818
1694 @deffn primitive class-direct-slots obj
1695 Return the direct slots of the class @var{obj}.
1696 @end deffn
1697
1698 \fclass-direct-subclasses
1699 @c snarfed from goops.c:828
1700 @deffn primitive class-direct-subclasses obj
1701 Return the direct subclasses of the class @var{obj}.
1702 @end deffn
1703
1704 \fclass-direct-methods
1705 @c snarfed from goops.c:838
1706 @deffn primitive class-direct-methods obj
1707 Return the direct methods of the class @var{obj}
1708 @end deffn
1709
1710 \fclass-precedence-list
1711 @c snarfed from goops.c:848
1712 @deffn primitive class-precedence-list obj
1713 Return the class precedence list of the class @var{obj}.
1714 @end deffn
1715
1716 \fclass-slots
1717 @c snarfed from goops.c:858
1718 @deffn primitive class-slots obj
1719 Return the slot list of the class @var{obj}.
1720 @end deffn
1721
1722 \fclass-environment
1723 @c snarfed from goops.c:868
1724 @deffn primitive class-environment obj
1725 Return the environment of the class @var{obj}.
1726 @end deffn
1727
1728 \fgeneric-function-name
1729 @c snarfed from goops.c:879
1730 @deffn primitive generic-function-name obj
1731 Return the name of the generic function @var{obj}.
1732 @end deffn
1733
1734 \fgeneric-function-methods
1735 @c snarfed from goops.c:889
1736 @deffn primitive generic-function-methods obj
1737 Return the methods of the generic function @var{obj}.
1738 @end deffn
1739
1740 \fmethod-generic-function
1741 @c snarfed from goops.c:900
1742 @deffn primitive method-generic-function obj
1743 Return the generic function fot the method @var{obj}.
1744 @end deffn
1745
1746 \fmethod-specializers
1747 @c snarfed from goops.c:910
1748 @deffn primitive method-specializers obj
1749 Return specializers of the method @var{obj}.
1750 @end deffn
1751
1752 \fmethod-procedure
1753 @c snarfed from goops.c:920
1754 @deffn primitive method-procedure obj
1755 Return the procedure of the method @var{obj}.
1756 @end deffn
1757
1758 \faccessor-method-slot-definition
1759 @c snarfed from goops.c:930
1760 @deffn primitive accessor-method-slot-definition obj
1761 Return the slot definition of the accessor @var{obj}.
1762 @end deffn
1763
1764 \f%tag-body
1765 @c snarfed from goops.c:940
1766 @deffn primitive %tag-body body
1767 Internal GOOPS magic---don't use this function!
1768 @end deffn
1769
1770 \fmake-unbound
1771 @c snarfed from goops.c:955
1772 @deffn primitive make-unbound
1773 Return the unbound value.
1774 @end deffn
1775
1776 \funbound?
1777 @c snarfed from goops.c:964
1778 @deffn primitive unbound? obj
1779 Return @code{#t} if @var{obj} is unbound.
1780 @end deffn
1781
1782 \fassert-bound
1783 @c snarfed from goops.c:974
1784 @deffn primitive assert-bound value obj
1785 Return @var{value} if it is bound, and invoke the
1786 @var{slot-unbound} method of @var{obj} if it is not.
1787 @end deffn
1788
1789 \f@@assert-bound-ref
1790 @c snarfed from goops.c:986
1791 @deffn primitive @@assert-bound-ref obj index
1792 Like @code{assert-bound}, but use @var{index} for accessing
1793 the value from @var{obj}.
1794 @end deffn
1795
1796 \f%fast-slot-ref
1797 @c snarfed from goops.c:998
1798 @deffn primitive %fast-slot-ref obj index
1799 Return the slot value with index @var{index} from @var{obj}.
1800 @end deffn
1801
1802 \f%fast-slot-set!
1803 @c snarfed from goops.c:1015
1804 @deffn primitive %fast-slot-set! obj index value
1805 Set the slot with index @var{index} in @var{obj} to
1806 @var{value}.
1807 @end deffn
1808
1809 \fslot-ref-using-class
1810 @c snarfed from goops.c:1143
1811 @deffn primitive slot-ref-using-class class obj slot_name
1812 @end deffn
1813
1814 \fslot-set-using-class!
1815 @c snarfed from goops.c:1162
1816 @deffn primitive slot-set-using-class! class obj slot_name value
1817 @end deffn
1818
1819 \fslot-bound-using-class?
1820 @c snarfed from goops.c:1176
1821 @deffn primitive slot-bound-using-class? class obj slot_name
1822 @end deffn
1823
1824 \fslot-exists-using-class?
1825 @c snarfed from goops.c:1191
1826 @deffn primitive slot-exists-using-class? class obj slot_name
1827 @end deffn
1828
1829 \fslot-ref
1830 @c snarfed from goops.c:1207
1831 @deffn primitive slot-ref obj slot_name
1832 Return the value from @var{obj}'s slot with the name
1833 @var{slot_name}.
1834 @end deffn
1835
1836 \fslot-set!
1837 @c snarfed from goops.c:1224
1838 @deffn primitive slot-set! obj slot_name value
1839 Set the slot named @var{slot_name} of @var{obj} to @var{value}.
1840 @end deffn
1841
1842 \fslot-bound?
1843 @c snarfed from goops.c:1241
1844 @deffn primitive slot-bound? obj slot_name
1845 Return @code{#t} if the slot named @var{slot_name} of @var{obj}
1846 is bound.
1847 @end deffn
1848
1849 \fslot-exists?
1850 @c snarfed from goops.c:1259
1851 @deffn primitive slot-exists? obj slot_name
1852 Return @code{#t} if @var{obj} has a slot named @var{slot_name}.
1853 @end deffn
1854
1855 \f%allocate-instance
1856 @c snarfed from goops.c:1302
1857 @deffn primitive %allocate-instance class initargs
1858 Create a new instance of class @var{class} and initialize it
1859 from the arguments @var{initargs}.
1860 @end deffn
1861
1862 \f%set-object-setter!
1863 @c snarfed from goops.c:1375
1864 @deffn primitive %set-object-setter! obj setter
1865 @end deffn
1866
1867 \f%modify-instance
1868 @c snarfed from goops.c:1400
1869 @deffn primitive %modify-instance old new
1870 @end deffn
1871
1872 \f%modify-class
1873 @c snarfed from goops.c:1426
1874 @deffn primitive %modify-class old new
1875 @end deffn
1876
1877 \f%invalidate-class
1878 @c snarfed from goops.c:1450
1879 @deffn primitive %invalidate-class class
1880 @end deffn
1881
1882 \f%invalidate-method-cache!
1883 @c snarfed from goops.c:1571
1884 @deffn primitive %invalidate-method-cache! gf
1885 @end deffn
1886
1887 \fgeneric-capability?
1888 @c snarfed from goops.c:1597
1889 @deffn primitive generic-capability? proc
1890 @end deffn
1891
1892 \fenable-primitive-generic!
1893 @c snarfed from goops.c:1610
1894 @deffn primitive enable-primitive-generic! . subrs
1895 @end deffn
1896
1897 \fprimitive-generic-generic
1898 @c snarfed from goops.c:1630
1899 @deffn primitive primitive-generic-generic subr
1900 @end deffn
1901
1902 \fmake
1903 @c snarfed from goops.c:1989
1904 @deffn primitive make . args
1905 Make a new object. @var{args} must contain the class and
1906 all necessary initialization information.
1907 @end deffn
1908
1909 \ffind-method
1910 @c snarfed from goops.c:2082
1911 @deffn primitive find-method . l
1912 @end deffn
1913
1914 \f%method-more-specific?
1915 @c snarfed from goops.c:2102
1916 @deffn primitive %method-more-specific? m1 m2 targs
1917 @end deffn
1918
1919 \f%goops-loaded
1920 @c snarfed from goops.c:2634
1921 @deffn primitive %goops-loaded
1922 Announce that GOOPS is loaded and perform initialization
1923 on the C level which depends on the loaded GOOPS modules.
1924 @end deffn
1925
1926 \fmake-guardian
1927 @c snarfed from guardians.c:336
1928 @deffn primitive make-guardian [greedy_p]
1929 Create a new guardian.
1930 A guardian protects a set of objects from garbage collection,
1931 allowing a program to apply cleanup or other actions.
1932
1933 @code{make-guardian} returns a procedure representing the guardian.
1934 Calling the guardian procedure with an argument adds the
1935 argument to the guardian's set of protected objects.
1936 Calling the guardian procedure without an argument returns
1937 one of the protected objects which are ready for garbage
1938 collection, or @code{#f} if no such object is available.
1939 Objects which are returned in this way are removed from
1940 the guardian.
1941
1942 @code{make-guardian} takes one optional argument that says whether the
1943 new guardian should be greedy or sharing. If there is any chance
1944 that any object protected by the guardian may be resurrected,
1945 then you should make the guardian greedy (this is the default).
1946
1947 See R. Kent Dybvig, Carl Bruggeman, and David Eby (1993)
1948 "Guardians in a Generation-Based Garbage Collector".
1949 ACM SIGPLAN Conference on Programming Language Design
1950 and Implementation, June 1993.
1951
1952 (the semantics are slightly different at this point, but the
1953 paper still (mostly) accurately describes the interface).
1954 @end deffn
1955
1956 \fguardian-destroyed?
1957 @c snarfed from guardians.c:364
1958 @deffn primitive guardian-destroyed? guardian
1959 Return @code{#t} if @var{guardian} has been destroyed, otherwise @code{#f}.
1960 @end deffn
1961
1962 \fguardian-greedy?
1963 @c snarfed from guardians.c:382
1964 @deffn primitive guardian-greedy? guardian
1965 Return @code{#t} if @var{guardian} is a greedy guardian, otherwise @code{#f}.
1966 @end deffn
1967
1968 \fdestroy-guardian!
1969 @c snarfed from guardians.c:393
1970 @deffn primitive destroy-guardian! guardian
1971 Destroys @var{guardian}, by making it impossible to put any more
1972 objects in it or get any objects from it. It also unguards any
1973 objects guarded by @var{guardian}.
1974 @end deffn
1975
1976 \fhashq
1977 @c snarfed from hash.c:202
1978 @deffn primitive hashq key size
1979 Determine a hash value for @var{key} that is suitable for
1980 lookups in a hashtable of size @var{size}, where @code{eq?} is
1981 used as the equality predicate. The function returns an
1982 integer in the range 0 to @var{size} - 1. Note that
1983 @code{hashq} may use internal addresses. Thus two calls to
1984 hashq where the keys are @code{eq?} are not guaranteed to
1985 deliver the same value if the key object gets garbage collected
1986 in between. This can happen, for example with symbols:
1987 @code{(hashq 'foo n) (gc) (hashq 'foo n)} may produce two
1988 different values, since @code{foo} will be garbage collected.
1989 @end deffn
1990
1991 \fhashv
1992 @c snarfed from hash.c:238
1993 @deffn primitive hashv key size
1994 Determine a hash value for @var{key} that is suitable for
1995 lookups in a hashtable of size @var{size}, where @code{eqv?} is
1996 used as the equality predicate. The function returns an
1997 integer in the range 0 to @var{size} - 1. Note that
1998 @code{(hashv key)} may use internal addresses. Thus two calls
1999 to hashv where the keys are @code{eqv?} are not guaranteed to
2000 deliver the same value if the key object gets garbage collected
2001 in between. This can happen, for example with symbols:
2002 @code{(hashv 'foo n) (gc) (hashv 'foo n)} may produce two
2003 different values, since @code{foo} will be garbage collected.
2004 @end deffn
2005
2006 \fhash
2007 @c snarfed from hash.c:261
2008 @deffn primitive hash key size
2009 Determine a hash value for @var{key} that is suitable for
2010 lookups in a hashtable of size @var{size}, where @code{equal?}
2011 is used as the equality predicate. The function returns an
2012 integer in the range 0 to @var{size} - 1.
2013 @end deffn
2014
2015 \fhashq-get-handle
2016 @c snarfed from hashtab.c:174
2017 @deffn primitive hashq-get-handle table obj
2018 This procedure is similar to its @code{-ref} cousin, but returns a
2019 @dfn{handle} from the hash table rather than the value associated with
2020 @var{key}. By convention, a handle in a hash table is the pair which
2021 associates a key with a value. Where @code{hashq-ref table key} returns
2022 only a @code{value}, @code{hashq-get-handle table key} returns the pair
2023 @code{(key . value)}.
2024 @end deffn
2025
2026 \fhashq-create-handle!
2027 @c snarfed from hashtab.c:186
2028 @deffn primitive hashq-create-handle! table key init
2029 This function looks up @var{key} in @var{table} and returns its handle.
2030 If @var{key} is not already present, a new handle is created which
2031 associates @var{key} with @var{init}.
2032 @end deffn
2033
2034 \fhashq-ref
2035 @c snarfed from hashtab.c:199
2036 @deffn primitive hashq-ref table obj [dflt]
2037 Look up @var{key} in the hash table @var{table}, and return the
2038 value (if any) associated with it. If @var{key} is not found,
2039 return @var{default} (or @code{#f} if no @var{default} argument
2040 is supplied). Uses @code{eq?} for equality testing.
2041 @end deffn
2042
2043 \fhashq-set!
2044 @c snarfed from hashtab.c:213
2045 @deffn primitive hashq-set! table obj val
2046 Find the entry in @var{table} associated with @var{key}, and
2047 store @var{value} there. Uses @code{eq?} for equality testing.
2048 @end deffn
2049
2050 \fhashq-remove!
2051 @c snarfed from hashtab.c:225
2052 @deffn primitive hashq-remove! table obj
2053 Remove @var{key} (and any value associated with it) from
2054 @var{table}. Uses @code{eq?} for equality tests.
2055 @end deffn
2056
2057 \fhashv-get-handle
2058 @c snarfed from hashtab.c:242
2059 @deffn primitive hashv-get-handle table obj
2060 This procedure is similar to its @code{-ref} cousin, but returns a
2061 @dfn{handle} from the hash table rather than the value associated with
2062 @var{key}. By convention, a handle in a hash table is the pair which
2063 associates a key with a value. Where @code{hashv-ref table key} returns
2064 only a @code{value}, @code{hashv-get-handle table key} returns the pair
2065 @code{(key . value)}.
2066 @end deffn
2067
2068 \fhashv-create-handle!
2069 @c snarfed from hashtab.c:254
2070 @deffn primitive hashv-create-handle! table key init
2071 This function looks up @var{key} in @var{table} and returns its handle.
2072 If @var{key} is not already present, a new handle is created which
2073 associates @var{key} with @var{init}.
2074 @end deffn
2075
2076 \fhashv-ref
2077 @c snarfed from hashtab.c:267
2078 @deffn primitive hashv-ref table obj [dflt]
2079 Look up @var{key} in the hash table @var{table}, and return the
2080 value (if any) associated with it. If @var{key} is not found,
2081 return @var{default} (or @code{#f} if no @var{default} argument
2082 is supplied). Uses @code{eqv?} for equality testing.
2083 @end deffn
2084
2085 \fhashv-set!
2086 @c snarfed from hashtab.c:281
2087 @deffn primitive hashv-set! table obj val
2088 Find the entry in @var{table} associated with @var{key}, and
2089 store @var{value} there. Uses @code{eqv?} for equality testing.
2090 @end deffn
2091
2092 \fhashv-remove!
2093 @c snarfed from hashtab.c:292
2094 @deffn primitive hashv-remove! table obj
2095 Remove @var{key} (and any value associated with it) from
2096 @var{table}. Uses @code{eqv?} for equality tests.
2097 @end deffn
2098
2099 \fhash-get-handle
2100 @c snarfed from hashtab.c:308
2101 @deffn primitive hash-get-handle table obj
2102 This procedure is similar to its @code{-ref} cousin, but returns a
2103 @dfn{handle} from the hash table rather than the value associated with
2104 @var{key}. By convention, a handle in a hash table is the pair which
2105 associates a key with a value. Where @code{hash-ref table key} returns
2106 only a @code{value}, @code{hash-get-handle table key} returns the pair
2107 @code{(key . value)}.
2108 @end deffn
2109
2110 \fhash-create-handle!
2111 @c snarfed from hashtab.c:320
2112 @deffn primitive hash-create-handle! table key init
2113 This function looks up @var{key} in @var{table} and returns its handle.
2114 If @var{key} is not already present, a new handle is created which
2115 associates @var{key} with @var{init}.
2116 @end deffn
2117
2118 \fhash-ref
2119 @c snarfed from hashtab.c:333
2120 @deffn primitive hash-ref table obj [dflt]
2121 Look up @var{key} in the hash table @var{table}, and return the
2122 value (if any) associated with it. If @var{key} is not found,
2123 return @var{default} (or @code{#f} if no @var{default} argument
2124 is supplied). Uses @code{equal?} for equality testing.
2125 @end deffn
2126
2127 \fhash-set!
2128 @c snarfed from hashtab.c:348
2129 @deffn primitive hash-set! table obj val
2130 Find the entry in @var{table} associated with @var{key}, and
2131 store @var{value} there. Uses @code{equal?} for equality
2132 testing.
2133 @end deffn
2134
2135 \fhash-remove!
2136 @c snarfed from hashtab.c:360
2137 @deffn primitive hash-remove! table obj
2138 Remove @var{key} (and any value associated with it) from
2139 @var{table}. Uses @code{equal?} for equality tests.
2140 @end deffn
2141
2142 \fhashx-get-handle
2143 @c snarfed from hashtab.c:429
2144 @deffn primitive hashx-get-handle hash assoc table obj
2145 This behaves the same way as the corresponding @code{-get-handle}
2146 function, but uses @var{hasher} as a
2147 hash function and @var{assoc} to compare keys. @code{hasher} must
2148 be a function that takes two arguments, a key to be hashed and a
2149 table size. @code{assoc} must be an associator function, like
2150 @code{assoc}, @code{assq} or @code{assv}.
2151 @end deffn
2152
2153 \fhashx-create-handle!
2154 @c snarfed from hashtab.c:447
2155 @deffn primitive hashx-create-handle! hash assoc table obj init
2156 This behaves the same way as the corresponding @code{-create-handle}
2157 function, but uses @var{hasher} as a
2158 hash function and @var{assoc} to compare keys. @code{hasher} must
2159 be a function that takes two arguments, a key to be hashed and a
2160 table size. @code{assoc} must be an associator function, like
2161 @code{assoc}, @code{assq} or @code{assv}.
2162 @end deffn
2163
2164 \fhashx-ref
2165 @c snarfed from hashtab.c:468
2166 @deffn primitive hashx-ref hash assoc table obj [dflt]
2167 This behaves the same way as the corresponding @code{ref}
2168 function, but uses @var{hasher} as a
2169 hash function and @var{assoc} to compare keys. @code{hasher} must
2170 be a function that takes two arguments, a key to be hashed and a
2171 table size. @code{assoc} must be an associator function, like
2172 @code{assoc}, @code{assq} or @code{assv}.
2173
2174 By way of illustration, @code{hashq-ref table key} is equivalent
2175 to @code{hashx-ref hashq assq table key}.
2176 @end deffn
2177
2178 \fhashx-set!
2179 @c snarfed from hashtab.c:492
2180 @deffn primitive hashx-set! hash assoc table obj val
2181 This behaves the same way as the corresponding @code{set!}
2182 function, but uses @var{hasher} as a
2183 hash function and @var{assoc} to compare keys. @code{hasher} must
2184 be a function that takes two arguments, a key to be hashed and a
2185 table size. @code{assoc} must be an associator function, like
2186 @code{assoc}, @code{assq} or @code{assv}.
2187
2188 By way of illustration, @code{hashq-set! table key} is equivalent
2189 to @code{hashx-set! hashq assq table key}.
2190 @end deffn
2191
2192 \fhash-fold
2193 @c snarfed from hashtab.c:529
2194 @deffn primitive hash-fold proc init table
2195 An iterator over hash-table elements.
2196 Accumulates and returns a result by applying PROC successively.
2197 The arguments to PROC are "(key value prior-result)" where key
2198 and value are successive pairs from the hash table TABLE, and
2199 prior-result is either INIT (for the first application of PROC)
2200 or the return value of the previous application of PROC.
2201 For example, @code{(hash-fold acons () tab)} will convert a hash
2202 table into an a-list of key-value pairs.
2203 @end deffn
2204
2205 \fmake-hook-with-name
2206 @c snarfed from hooks.c:216
2207 @deffn primitive make-hook-with-name name [n_args]
2208 Create a named hook with the name @var{name} for storing
2209 procedures of arity @var{n_args}.
2210 @end deffn
2211
2212 \fmake-hook
2213 @c snarfed from hooks.c:230
2214 @deffn primitive make-hook [n_args]
2215 Create a hook for storing procedure of arity @var{n_args}.
2216 @end deffn
2217
2218 \fhook?
2219 @c snarfed from hooks.c:240
2220 @deffn primitive hook? x
2221 Return @code{#t} if @var{x} is a hook.
2222 @end deffn
2223
2224 \fhook-empty?
2225 @c snarfed from hooks.c:250
2226 @deffn primitive hook-empty? hook
2227 Return @code{#t} if @var{hook} is an empty hook.
2228 @end deffn
2229
2230 \fadd-hook!
2231 @c snarfed from hooks.c:263
2232 @deffn primitive add-hook! hook proc [append_p]
2233 Add the procedure @var{proc} to the hook @var{hook}. The
2234 procedure is added to the end if @var{append_p} is true,
2235 otherwise it is added to the front.
2236 @end deffn
2237
2238 \fremove-hook!
2239 @c snarfed from hooks.c:289
2240 @deffn primitive remove-hook! hook proc
2241 Remove the procedure @var{proc} from the hook @var{hook}.
2242 @end deffn
2243
2244 \freset-hook!
2245 @c snarfed from hooks.c:302
2246 @deffn primitive reset-hook! hook
2247 Remove all procedures from the hook @var{hook}.
2248 @end deffn
2249
2250 \frun-hook
2251 @c snarfed from hooks.c:315
2252 @deffn primitive run-hook hook . args
2253 Apply all procedures from the hook @var{hook} to the arguments
2254 @var{args}.
2255 @end deffn
2256
2257 \fhook->list
2258 @c snarfed from hooks.c:342
2259 @deffn primitive hook->list hook
2260 Convert the procedure list of @var{hook} to a list.
2261 @end deffn
2262
2263 \fread-string!/partial
2264 @c snarfed from ioext.c:114
2265 @deffn primitive read-string!/partial str [port_or_fdes [start [end]]]
2266 Read characters from an fport or file descriptor into a
2267 string @var{str}. This procedure is scsh-compatible
2268 and can efficiently read large strings. It will:
2269
2270 @itemize
2271 @item
2272 attempt to fill the entire string, unless the @var{start}
2273 and/or @var{end} arguments are supplied. i.e., @var{start}
2274 defaults to 0 and @var{end} defaults to
2275 @code{(string-length str)}
2276 @item
2277 use the current input port if @var{port_or_fdes} is not
2278 supplied.
2279 @item
2280 read any characters that are currently available,
2281 without waiting for the rest (short reads are possible).
2282
2283 @item
2284 wait for as long as it needs to for the first character to
2285 become available, unless the port is in non-blocking mode
2286 @item
2287 return @code{#f} if end-of-file is encountered before reading
2288 any characters, otherwise return the number of characters
2289 read.
2290 @item
2291 return 0 if the port is in non-blocking mode and no characters
2292 are immediately available.
2293 @item
2294 return 0 if the request is for 0 bytes, with no
2295 end-of-file check
2296 @end itemize
2297 @end deffn
2298
2299 \fftell
2300 @c snarfed from ioext.c:173
2301 @deffn primitive ftell object
2302 Returns an integer representing the current position of @var{fd/port},
2303 measured from the beginning. Equivalent to:
2304 @smalllisp
2305 (seek port 0 SEEK_CUR)
2306 @end smalllisp
2307 @end deffn
2308
2309 \ffseek
2310 @c snarfed from ioext.c:186
2311 @deffn primitive fseek object offset whence
2312 Obsolete. Almost the same as seek, above, but the return value is
2313 unspecified.
2314 @end deffn
2315
2316 \fredirect-port
2317 @c snarfed from ioext.c:208
2318 @deffn primitive redirect-port old new
2319 This procedure takes two ports and duplicates the underlying file
2320 descriptor from @var{old-port} into @var{new-port}. The
2321 current file descriptor in @var{new-port} will be closed.
2322 After the redirection the two ports will share a file position
2323 and file status flags.
2324
2325 The return value is unspecified.
2326
2327 Unexpected behaviour can result if both ports are subsequently used
2328 and the original and/or duplicate ports are buffered.
2329
2330 This procedure does not have any side effects on other ports or
2331 revealed counts.
2332 @end deffn
2333
2334 \fdup->fdes
2335 @c snarfed from ioext.c:245
2336 @deffn primitive dup->fdes fd_or_port [fd]
2337 Returns an integer file descriptor.
2338 @end deffn
2339
2340 \fdup2
2341 @c snarfed from ioext.c:292
2342 @deffn primitive dup2 oldfd newfd
2343 A simple wrapper for the @code{dup2} system call.
2344 Copies the file descriptor @var{oldfd} to descriptor
2345 number @var{newfd}, replacing the previous meaning
2346 of @var{newfd}. Both @var{oldfd} and @var{newfd} must
2347 be integers.
2348 Unlike for dup->fdes or primitive-move->fdes, no attempt
2349 is made to move away ports which are using @var{newfd}.
2350 The return value is unspecified.
2351 @end deffn
2352
2353 \ffileno
2354 @c snarfed from ioext.c:311
2355 @deffn primitive fileno port
2356 Returns the integer file descriptor underlying @var{port}.
2357 Does not change its revealed count.
2358 @end deffn
2359
2360 \fisatty?
2361 @c snarfed from ioext.c:327
2362 @deffn primitive isatty? port
2363 Returns @code{#t} if @var{port} is using a serial
2364 non-file device, otherwise @code{#f}.
2365 @end deffn
2366
2367 \ffdopen
2368 @c snarfed from ioext.c:349
2369 @deffn primitive fdopen fdes modes
2370 Returns a new port based on the file descriptor @var{fdes}.
2371 Modes are given by the string @var{modes}. The revealed count of the port
2372 is initialized to zero. The modes string is the same as that accepted
2373 by @ref{File Ports, open-file}.
2374 @end deffn
2375
2376 \fprimitive-move->fdes
2377 @c snarfed from ioext.c:374
2378 @deffn primitive primitive-move->fdes port fd
2379 Moves the underlying file descriptor for @var{port} to the integer
2380 value @var{fdes} without changing the revealed count of @var{port}.
2381 Any other ports already using this descriptor will be automatically
2382 shifted to new descriptors and their revealed counts reset to zero.
2383 The return value is @code{#f} if the file descriptor already had the
2384 required value or @code{#t} if it was moved.
2385 @end deffn
2386
2387 \ffdes->ports
2388 @c snarfed from ioext.c:407
2389 @deffn primitive fdes->ports fd
2390 Returns a list of existing ports which have @var{fdes} as an
2391 underlying file descriptor, without changing their revealed counts.
2392 @end deffn
2393
2394 \fmake-keyword-from-dash-symbol
2395 @c snarfed from keywords.c:71
2396 @deffn primitive make-keyword-from-dash-symbol symbol
2397 Make a keyword object from a @var{symbol} that starts with a dash.
2398 @end deffn
2399
2400 \fkeyword?
2401 @c snarfed from keywords.c:112
2402 @deffn primitive keyword? obj
2403 Returns @code{#t} if the argument @var{obj} is a keyword, else @code{#f}.
2404 @end deffn
2405
2406 \fkeyword-dash-symbol
2407 @c snarfed from keywords.c:123
2408 @deffn primitive keyword-dash-symbol keyword
2409 Return the dash symbol for @var{keyword}.
2410 This is the inverse of @code{make-keyword-from-dash-symbol}.
2411 @end deffn
2412
2413 \fnil-cons
2414 @c snarfed from lang.c:71
2415 @deffn primitive nil-cons x y
2416 Create a new cons cell with @var{x} as the car and @var{y} as
2417 the cdr, but convert @var{y} to Scheme's end-of-list if it is
2418 a LISP nil.
2419 @end deffn
2420
2421 \fnil-car
2422 @c snarfed from lang.c:86
2423 @deffn primitive nil-car x
2424 Return the car of @var{x}, but convert it to LISP nil if it
2425 is Scheme's end-of-list.
2426 @end deffn
2427
2428 \fnil-cdr
2429 @c snarfed from lang.c:99
2430 @deffn primitive nil-cdr x
2431 Return the cdr of @var{x}, but convert it to LISP nil if it
2432 is Scheme's end-of-list.
2433 @end deffn
2434
2435 \fnull
2436 @c snarfed from lang.c:114
2437 @deffn primitive null x
2438 Return LISP's @code{t} if @var{x} is nil in the LISP sense,
2439 return LISP's nil otherwise.
2440 @end deffn
2441
2442 \fnil-eq
2443 @c snarfed from lang.c:143
2444 @deffn primitive nil-eq x y
2445 Compare @var{x} and @var{y} and return LISP's t if they are
2446 @code{eq?}, return LISP's nil otherwise.
2447 @end deffn
2448
2449 \flist
2450 @c snarfed from list.c:84
2451 @deffn primitive list . objs
2452 Return a list containing @var{objs}, the arguments to
2453 @code{list}.
2454 @end deffn
2455
2456 \flist*
2457 @c snarfed from list.c:94
2458 @deffn primitive list*
2459 scm_cons_star
2460 @end deffn
2461
2462 \fcons*
2463 @c snarfed from list.c:105
2464 @deffn primitive cons* arg . rest
2465 Like @code{list}, but the last arg provides the tail of the
2466 constructed list, returning @code{(cons @var{arg1} (cons
2467 @var{arg2} (cons @dots{} @var{argn})))}. Requires at least one
2468 argument. If given one argument, that argument is returned as
2469 result. This function is called @code{list*} in some other
2470 Schemes and in Common LISP.
2471 @end deffn
2472
2473 \fnull?
2474 @c snarfed from list.c:129
2475 @deffn primitive null? x
2476 Return @code{#t} iff @var{x} is the empty list, else @code{#f}.
2477 @end deffn
2478
2479 \flist?
2480 @c snarfed from list.c:139
2481 @deffn primitive list? x
2482 Return @code{#t} iff @var{x} is a proper list, else @code{#f}.
2483 @end deffn
2484
2485 \flength
2486 @c snarfed from list.c:180
2487 @deffn primitive length lst
2488 Return the number of elements in list @var{lst}.
2489 @end deffn
2490
2491 \fappend
2492 @c snarfed from list.c:209
2493 @deffn primitive append . args
2494 Return a list consisting of the elements the lists passed as
2495 arguments.
2496 @example
2497 (append '(x) '(y)) @result{} (x y)
2498 (append '(a) '(b c d)) @result{} (a b c d)
2499 (append '(a (b)) '((c))) @result{} (a (b) (c))
2500 @end example
2501 The resulting list is always newly allocated, except that it
2502 shares structure with the last list argument. The last
2503 argument may actually be any object; an improper list results
2504 if the last argument is not a proper list.
2505 @example
2506 (append '(a b) '(c . d)) @result{} (a b c . d)
2507 (append '() 'a) @result{} a
2508 @end example
2509 @end deffn
2510
2511 \fappend!
2512 @c snarfed from list.c:242
2513 @deffn primitive append! . args
2514 A destructive version of @code{append} (@pxref{Pairs and Lists,,,r4rs,
2515 The Revised^4 Report on Scheme}). The cdr field of each list's final
2516 pair is changed to point to the head of the next list, so no consing is
2517 performed. Return a pointer to the mutated list.
2518 @end deffn
2519
2520 \flast-pair
2521 @c snarfed from list.c:268
2522 @deffn primitive last-pair lst
2523 Return a pointer to the last pair in @var{lst}, signalling an error if
2524 @var{lst} is circular.
2525 @end deffn
2526
2527 \freverse
2528 @c snarfed from list.c:298
2529 @deffn primitive reverse lst
2530 Return a new list that contains the elements of @var{lst} but
2531 in reverse order.
2532 @end deffn
2533
2534 \freverse!
2535 @c snarfed from list.c:332
2536 @deffn primitive reverse! lst [new_tail]
2537 A destructive version of @code{reverse} (@pxref{Pairs and Lists,,,r4rs,
2538 The Revised^4 Report on Scheme}). The cdr of each cell in @var{lst} is
2539 modified to point to the previous list element. Return a pointer to the
2540 head of the reversed list.
2541
2542 Caveat: because the list is modified in place, the tail of the original
2543 list now becomes its head, and the head of the original list now becomes
2544 the tail. Therefore, the @var{lst} symbol to which the head of the
2545 original list was bound now points to the tail. To ensure that the head
2546 of the modified list is not lost, it is wise to save the return value of
2547 @code{reverse!}
2548 @end deffn
2549
2550 \flist-ref
2551 @c snarfed from list.c:358
2552 @deffn primitive list-ref list k
2553 Return the @var{k}th element from @var{list}.
2554 @end deffn
2555
2556 \flist-set!
2557 @c snarfed from list.c:382
2558 @deffn primitive list-set! list k val
2559 Set the @var{k}th element of @var{list} to @var{val}.
2560 @end deffn
2561
2562 \flist-cdr-ref
2563 @c snarfed from list.c:405
2564 @deffn primitive list-cdr-ref
2565 scm_list_tail
2566 @end deffn
2567
2568 \flist-tail
2569 @c snarfed from list.c:414
2570 @deffn primitive list-tail lst k
2571 @deffnx primitive list-cdr-ref lst k
2572 Return the "tail" of @var{lst} beginning with its @var{k}th element.
2573 The first element of the list is considered to be element 0.
2574
2575 @code{list-tail} and @code{list-cdr-ref} are identical. It may help to
2576 think of @code{list-cdr-ref} as accessing the @var{k}th cdr of the list,
2577 or returning the results of cdring @var{k} times down @var{lst}.
2578 @end deffn
2579
2580 \flist-cdr-set!
2581 @c snarfed from list.c:430
2582 @deffn primitive list-cdr-set! list k val
2583 Set the @var{k}th cdr of @var{list} to @var{val}.
2584 @end deffn
2585
2586 \flist-head
2587 @c snarfed from list.c:459
2588 @deffn primitive list-head lst k
2589 Copy the first @var{k} elements from @var{lst} into a new list, and
2590 return it.
2591 @end deffn
2592
2593 \flist-copy
2594 @c snarfed from list.c:483
2595 @deffn primitive list-copy lst
2596 Return a (newly-created) copy of @var{lst}.
2597 @end deffn
2598
2599 \fsloppy-memq
2600 @c snarfed from list.c:517
2601 @deffn primitive sloppy-memq x lst
2602 This procedure behaves like @code{memq}, but does no type or error checking.
2603 Its use is recommended only in writing Guile internals,
2604 not for high-level Scheme programs.
2605 @end deffn
2606
2607 \fsloppy-memv
2608 @c snarfed from list.c:534
2609 @deffn primitive sloppy-memv x lst
2610 This procedure behaves like @code{memv}, but does no type or error checking.
2611 Its use is recommended only in writing Guile internals,
2612 not for high-level Scheme programs.
2613 @end deffn
2614
2615 \fsloppy-member
2616 @c snarfed from list.c:551
2617 @deffn primitive sloppy-member x lst
2618 This procedure behaves like @code{member}, but does no type or error checking.
2619 Its use is recommended only in writing Guile internals,
2620 not for high-level Scheme programs.
2621 @end deffn
2622
2623 \fmemq
2624 @c snarfed from list.c:591
2625 @deffn primitive memq x lst
2626 Return the first sublist of @var{lst} whose car is @code{eq?}
2627 to @var{x} where the sublists of @var{lst} are the non-empty
2628 lists returned by @code{(list-tail @var{lst} @var{k})} for
2629 @var{k} less than the length of @var{lst}. If @var{x} does not
2630 occur in @var{lst}, then @code{#f} (not the empty list) is
2631 returned.
2632 @end deffn
2633
2634 \fmemv
2635 @c snarfed from list.c:608
2636 @deffn primitive memv x lst
2637 Return the first sublist of @var{lst} whose car is @code{eqv?}
2638 to @var{x} where the sublists of @var{lst} are the non-empty
2639 lists returned by @code{(list-tail @var{lst} @var{k})} for
2640 @var{k} less than the length of @var{lst}. If @var{x} does not
2641 occur in @var{lst}, then @code{#f} (not the empty list) is
2642 returned.
2643 @end deffn
2644
2645 \fmember
2646 @c snarfed from list.c:629
2647 @deffn primitive member x lst
2648 Return the first sublist of @var{lst} whose car is
2649 @code{equal?} to @var{x} where the sublists of @var{lst} are
2650 the non-empty lists returned by @code{(list-tail @var{lst}
2651 @var{k})} for @var{k} less than the length of @var{lst}. If
2652 @var{x} does not occur in @var{lst}, then @code{#f} (not the
2653 empty list) is returned.
2654 @end deffn
2655
2656 \fdelq!
2657 @c snarfed from list.c:655
2658 @deffn primitive delq! item lst
2659 @deffnx primitive delv! item lst
2660 @deffnx primitive delete! item lst
2661 These procedures are destructive versions of @code{delq}, @code{delv}
2662 and @code{delete}: they modify the pointers in the existing @var{lst}
2663 rather than creating a new list. Caveat evaluator: Like other
2664 destructive list functions, these functions cannot modify the binding of
2665 @var{lst}, and so cannot be used to delete the first element of
2666 @var{lst} destructively.
2667 @end deffn
2668
2669 \fdelv!
2670 @c snarfed from list.c:679
2671 @deffn primitive delv! item lst
2672 Destructively remove all elements from @var{lst} that are
2673 @code{eqv?} to @var{item}.
2674 @end deffn
2675
2676 \fdelete!
2677 @c snarfed from list.c:704
2678 @deffn primitive delete! item lst
2679 Destructively remove all elements from @var{lst} that are
2680 @code{equal?} to @var{item}.
2681 @end deffn
2682
2683 \fdelq
2684 @c snarfed from list.c:733
2685 @deffn primitive delq item lst
2686 Return a newly-created copy of @var{lst} with elements
2687 @code{eq?} to @var{item} removed. This procedure mirrors
2688 @code{memq}: @code{delq} compares elements of @var{lst} against
2689 @var{item} with @code{eq?}.
2690 @end deffn
2691
2692 \fdelv
2693 @c snarfed from list.c:746
2694 @deffn primitive delv item lst
2695 Return a newly-created copy of @var{lst} with elements
2696 @code{eqv?} to @var{item} removed. This procedure mirrors
2697 @code{memv}: @code{delv} compares elements of @var{lst} against
2698 @var{item} with @code{eqv?}.
2699 @end deffn
2700
2701 \fdelete
2702 @c snarfed from list.c:759
2703 @deffn primitive delete item lst
2704 Return a newly-created copy of @var{lst} with elements
2705 @code{equal?} to @var{item} removed. This procedure mirrors
2706 @code{member}: @code{delete} compares elements of @var{lst}
2707 against @var{item} with @code{equal?}.
2708 @end deffn
2709
2710 \fdelq1!
2711 @c snarfed from list.c:772
2712 @deffn primitive delq1! item lst
2713 Like @code{delq!}, but only deletes the first occurrence of
2714 @var{item} from @var{lst}. Tests for equality using
2715 @code{eq?}. See also @code{delv1!} and @code{delete1!}.
2716 @end deffn
2717
2718 \fdelv1!
2719 @c snarfed from list.c:800
2720 @deffn primitive delv1! item lst
2721 Like @code{delv!}, but only deletes the first occurrence of
2722 @var{item} from @var{lst}. Tests for equality using
2723 @code{eqv?}. See also @code{delq1!} and @code{delete1!}.
2724 @end deffn
2725
2726 \fdelete1!
2727 @c snarfed from list.c:828
2728 @deffn primitive delete1! item lst
2729 Like @code{delete!}, but only deletes the first occurrence of
2730 @var{item} from @var{lst}. Tests for equality using
2731 @code{equal?}. See also @code{delq1!} and @code{delv1!}.
2732 @end deffn
2733
2734 \fprimitive-load
2735 @c snarfed from load.c:112
2736 @deffn primitive primitive-load filename
2737 Load the file named @var{filename} and evaluate its contents in
2738 the top-level environment. The load paths are not searched;
2739 @var{filename} must either be a full pathname or be a pathname
2740 relative to the current directory. If the variable
2741 @code{%load-hook} is defined, it should be bound to a procedure
2742 that will be called before any code is loaded. See the
2743 documentation for @code{%load-hook} later in this section.
2744 @end deffn
2745
2746 \f%package-data-dir
2747 @c snarfed from load.c:147
2748 @deffn primitive %package-data-dir
2749 Return the name of the directory where Scheme packages, modules and
2750 libraries are kept. On most Unix systems, this will be
2751 @samp{/usr/local/share/guile}.
2752 @end deffn
2753
2754 \f%library-dir
2755 @c snarfed from load.c:159
2756 @deffn primitive %library-dir
2757 Return the directory where the Guile Scheme library files are installed.
2758 E.g., may return "/usr/share/guile/1.3.5".
2759 @end deffn
2760
2761 \f%site-dir
2762 @c snarfed from load.c:171
2763 @deffn primitive %site-dir
2764 Return the directory where the Guile site files are installed.
2765 E.g., may return "/usr/share/guile/site".
2766 @end deffn
2767
2768 \fparse-path
2769 @c snarfed from load.c:223
2770 @deffn primitive parse-path path [tail]
2771 Parse @var{path}, which is expected to be a colon-separated
2772 string, into a list and return the resulting list with
2773 @var{tail} appended. If @var{path} is @code{#f}, @var{tail}
2774 is returned.
2775 @end deffn
2776
2777 \fsearch-path
2778 @c snarfed from load.c:273
2779 @deffn primitive search-path path filename [extensions]
2780 Search @var{path} for a directory containing a file named
2781 @var{filename}. The file must be readable, and not a directory.
2782 If we find one, return its full filename; otherwise, return
2783 @code{#f}. If @var{filename} is absolute, return it unchanged.
2784 If given, @var{extensions} is a list of strings; for each
2785 directory in @var{path}, we search for @var{filename}
2786 concatenated with each @var{extension}.
2787 @end deffn
2788
2789 \f%search-load-path
2790 @c snarfed from load.c:420
2791 @deffn primitive %search-load-path filename
2792 Search @var{%load-path} for the file named @var{filename},
2793 which must be readable by the current user. If @var{filename}
2794 is found in the list of paths to search or is an absolute
2795 pathname, return its full pathname. Otherwise, return
2796 @code{#f}. Filenames may have any of the optional extensions
2797 in the @code{%load-extensions} list; @code{%search-load-path}
2798 will try each extension automatically.
2799 @end deffn
2800
2801 \fprimitive-load-path
2802 @c snarfed from load.c:441
2803 @deffn primitive primitive-load-path filename
2804 Search @var{%load-path} for the file named @var{filename} and
2805 load it into the top-level environment. If @var{filename} is a
2806 relative pathname and is not found in the list of search paths,
2807 an error is signalled.
2808 @end deffn
2809
2810 \fread-and-eval!
2811 @c snarfed from load.c:476
2812 @deffn primitive read-and-eval! [port]
2813 Read a form from @var{port} (standard input by default), and evaluate it
2814 (memoizing it in the process) in the top-level environment. If no data
2815 is left to be read from @var{port}, an @code{end-of-file} error is
2816 signalled.
2817 @end deffn
2818
2819 \fprocedure->syntax
2820 @c snarfed from macros.c:60
2821 @deffn primitive procedure->syntax code
2822 Returns a @dfn{macro} which, when a symbol defined to this value
2823 appears as the first symbol in an expression, returns the result
2824 of applying @var{code} to the expression and the environment.
2825 @end deffn
2826
2827 \fprocedure->macro
2828 @c snarfed from macros.c:82
2829 @deffn primitive procedure->macro code
2830 Returns a @dfn{macro} which, when a symbol defined to this value
2831 appears as the first symbol in an expression, evaluates the result
2832 of applying @var{code} to the expression and the environment.
2833 The value returned from @var{code} which has been passed to
2834 @code{procedure->memoizing-macro} replaces the form passed to
2835 @var{code}. For example:
2836
2837 @example
2838 (define trace
2839 (procedure->macro
2840 (lambda (x env) `(set! ,(cadr x) (tracef ,(cadr x) ',(cadr x))))))
2841
2842 (trace @i{foo}) @equiv{} (set! @i{foo} (tracef @i{foo} '@i{foo})).
2843 @end example
2844 @end deffn
2845
2846 \fprocedure->memoizing-macro
2847 @c snarfed from macros.c:104
2848 @deffn primitive procedure->memoizing-macro code
2849 Returns a @dfn{macro} which, when a symbol defined to this value
2850 appears as the first symbol in an expression, evaluates the result
2851 of applying @var{proc} to the expression and the environment.
2852 The value returned from @var{proc} which has been passed to
2853 @code{procedure->memoizing-macro} replaces the form passed to
2854 @var{proc}. For example:
2855
2856 @example
2857 (define trace
2858 (procedure->macro
2859 (lambda (x env) `(set! ,(cadr x) (tracef ,(cadr x) ',(cadr x))))))
2860
2861 (trace @i{foo}) @equiv{} (set! @i{foo} (tracef @i{foo} '@i{foo})).
2862 @end example
2863 @end deffn
2864
2865 \fmacro?
2866 @c snarfed from macros.c:116
2867 @deffn primitive macro? obj
2868 Return @code{#t} if @var{obj} is a regular macro, a memoizing macro or a
2869 syntax transformer.
2870 @end deffn
2871
2872 \fmacro-type
2873 @c snarfed from macros.c:133
2874 @deffn primitive macro-type m
2875 Return one of the symbols @code{syntax}, @code{macro} or @code{macro!},
2876 depending on whether @var{obj} is a syntax tranformer, a regular macro,
2877 or a memoizing macro, respectively. If @var{obj} is not a macro,
2878 @code{#f} is returned.
2879 @end deffn
2880
2881 \fmacro-name
2882 @c snarfed from macros.c:151
2883 @deffn primitive macro-name m
2884 Return the name of the macro @var{m}.
2885 @end deffn
2886
2887 \fmacro-transformer
2888 @c snarfed from macros.c:162
2889 @deffn primitive macro-transformer m
2890 Return the transformer of the macro @var{m}.
2891 @end deffn
2892
2893 \finteraction-environment
2894 @c snarfed from modules.c:102
2895 @deffn primitive interaction-environment
2896 This procedure returns a specifier for the environment that contains
2897 implementation-defined bindings, typically a superset of those listed in
2898 the report. The intent is that this procedure will return the
2899 environment in which the implementation would evaluate expressions
2900 dynamically typed by the user.
2901 @end deffn
2902
2903 \fstandard-eval-closure
2904 @c snarfed from modules.c:271
2905 @deffn primitive standard-eval-closure module
2906 Return an eval closure for the module @var{module}.
2907 @end deffn
2908
2909 \finet-aton
2910 @c snarfed from net_db.c:96
2911 @deffn primitive inet-aton address
2912 Converts a string containing an Internet host address in the traditional
2913 dotted decimal notation into an integer.
2914
2915 @smalllisp
2916 (inet-aton "127.0.0.1") @result{} 2130706433
2917
2918 @end smalllisp
2919 @end deffn
2920
2921 \finet-ntoa
2922 @c snarfed from net_db.c:116
2923 @deffn primitive inet-ntoa inetid
2924 Converts an integer Internet host address into a string with the
2925 traditional dotted decimal representation.
2926
2927 @smalllisp
2928 (inet-ntoa 2130706433) @result{} "127.0.0.1"
2929 @end smalllisp
2930 @end deffn
2931
2932 \finet-netof
2933 @c snarfed from net_db.c:135
2934 @deffn primitive inet-netof address
2935 Returns the network number part of the given integer Internet address.
2936
2937 @smalllisp
2938 (inet-netof 2130706433) @result{} 127
2939 @end smalllisp
2940 @end deffn
2941
2942 \finet-lnaof
2943 @c snarfed from net_db.c:152
2944 @deffn primitive inet-lnaof address
2945 Returns the local-address-with-network part of the given Internet
2946 address.
2947
2948 @smalllisp
2949 (inet-lnaof 2130706433) @result{} 1
2950 @end smalllisp
2951 @end deffn
2952
2953 \finet-makeaddr
2954 @c snarfed from net_db.c:169
2955 @deffn primitive inet-makeaddr net lna
2956 Makes an Internet host address by combining the network number @var{net}
2957 with the local-address-within-network number @var{lna}.
2958
2959 @smalllisp
2960 (inet-makeaddr 127 1) @result{} 2130706433
2961 @end smalllisp
2962 @end deffn
2963
2964 \fgethost
2965 @c snarfed from net_db.c:254
2966 @deffn primitive gethost [host]
2967 @deffnx procedure gethostbyname hostname
2968 @deffnx procedure gethostbyaddr address
2969 Look up a host by name or address, returning a host object. The
2970 @code{gethost} procedure will accept either a string name or an integer
2971 address; if given no arguments, it behaves like @code{gethostent} (see
2972 below). If a name or address is supplied but the address can not be
2973 found, an error will be thrown to one of the keys:
2974 @code{host-not-found}, @code{try-again}, @code{no-recovery} or
2975 @code{no-data}, corresponding to the equivalent @code{h_error} values.
2976 Unusual conditions may result in errors thrown to the
2977 @code{system-error} or @code{misc_error} keys.
2978 @end deffn
2979
2980 \fgetnet
2981 @c snarfed from net_db.c:335
2982 @deffn primitive getnet [net]
2983 @deffnx procedure getnetbyname net-name
2984 @deffnx procedure getnetbyaddr net-number
2985 Look up a network by name or net number in the network database. The
2986 @var{net-name} argument must be a string, and the @var{net-number}
2987 argument must be an integer. @code{getnet} will accept either type of
2988 argument, behaving like @code{getnetent} (see below) if no arguments are
2989 given.
2990 @end deffn
2991
2992 \fgetproto
2993 @c snarfed from net_db.c:385
2994 @deffn primitive getproto [protocol]
2995 @deffnx procedure getprotobyname name
2996 @deffnx procedure getprotobynumber number
2997 Look up a network protocol by name or by number. @code{getprotobyname}
2998 takes a string argument, and @code{getprotobynumber} takes an integer
2999 argument. @code{getproto} will accept either type, behaving like
3000 @code{getprotoent} (see below) if no arguments are supplied.
3001 @end deffn
3002
3003 \fgetserv
3004 @c snarfed from net_db.c:452
3005 @deffn primitive getserv [name [protocol]]
3006 @deffnx procedure getservbyname name protocol
3007 @deffnx procedure getservbyport port protocol
3008 Look up a network service by name or by service number, and return a
3009 network service object. The @var{protocol} argument specifies the name
3010 of the desired protocol; if the protocol found in the network service
3011 database does not match this name, a system error is signalled.
3012
3013 The @code{getserv} procedure will take either a service name or number
3014 as its first argument; if given no arguments, it behaves like
3015 @code{getservent} (see below).
3016 @end deffn
3017
3018 \fsethost
3019 @c snarfed from net_db.c:491
3020 @deffn primitive sethost [stayopen]
3021 If @var{stayopen} is omitted, this is equivalent to @code{endhostent}.
3022 Otherwise it is equivalent to @code{sethostent stayopen}.
3023 @end deffn
3024
3025 \fsetnet
3026 @c snarfed from net_db.c:507
3027 @deffn primitive setnet [stayopen]
3028 If @var{stayopen} is omitted, this is equivalent to @code{endnetent}.
3029 Otherwise it is equivalent to @code{setnetent stayopen}.
3030 @end deffn
3031
3032 \fsetproto
3033 @c snarfed from net_db.c:523
3034 @deffn primitive setproto [stayopen]
3035 If @var{stayopen} is omitted, this is equivalent to @code{endprotoent}.
3036 Otherwise it is equivalent to @code{setprotoent stayopen}.
3037 @end deffn
3038
3039 \fsetserv
3040 @c snarfed from net_db.c:539
3041 @deffn primitive setserv [stayopen]
3042 If @var{stayopen} is omitted, this is equivalent to @code{endservent}.
3043 Otherwise it is equivalent to @code{setservent stayopen}.
3044 @end deffn
3045
3046 \fexact?
3047 @c snarfed from numbers.c:106
3048 @deffn primitive exact? x
3049 Return @code{#t} if @var{x} is an exact number, @code{#f}
3050 otherwise.
3051 @end deffn
3052
3053 \fodd?
3054 @c snarfed from numbers.c:123
3055 @deffn primitive odd? n
3056 Return @code{#t} if @var{n} is an odd number, @code{#f}
3057 otherwise.
3058 @end deffn
3059
3060 \feven?
3061 @c snarfed from numbers.c:140
3062 @deffn primitive even? n
3063 Return @code{#t} if @var{n} is an even number, @code{#f}
3064 otherwise.
3065 @end deffn
3066
3067 \flogand
3068 @c snarfed from numbers.c:755
3069 @deffn primitive logand n1 n2
3070 Returns the integer which is the bit-wise AND of the two integer
3071 arguments.
3072
3073 Example:
3074 @lisp
3075 (number->string (logand #b1100 #b1010) 2)
3076 @result{} "1000"
3077 @end lisp
3078 @end deffn
3079
3080 \flogior
3081 @c snarfed from numbers.c:842
3082 @deffn primitive logior n1 n2
3083 Returns the integer which is the bit-wise OR of the two integer
3084 arguments.
3085
3086 Example:
3087 @lisp
3088 (number->string (logior #b1100 #b1010) 2)
3089 @result{} "1110"
3090 @end lisp
3091 @end deffn
3092
3093 \flogxor
3094 @c snarfed from numbers.c:928
3095 @deffn primitive logxor n1 n2
3096 Returns the integer which is the bit-wise XOR of the two integer
3097 arguments.
3098
3099 Example:
3100 @lisp
3101 (number->string (logxor #b1100 #b1010) 2)
3102 @result{} "110"
3103 @end lisp
3104 @end deffn
3105
3106 \flogtest
3107 @c snarfed from numbers.c:997
3108 @deffn primitive logtest n1 n2
3109 @example
3110 (logtest j k) @equiv{} (not (zero? (logand j k)))
3111
3112 (logtest #b0100 #b1011) @result{} #f
3113 (logtest #b0100 #b0111) @result{} #t
3114 @end example
3115 @end deffn
3116
3117 \flogbit?
3118 @c snarfed from numbers.c:1054
3119 @deffn primitive logbit? index j
3120 @example
3121 (logbit? index j) @equiv{} (logtest (integer-expt 2 index) j)
3122
3123 (logbit? 0 #b1101) @result{} #t
3124 (logbit? 1 #b1101) @result{} #f
3125 (logbit? 2 #b1101) @result{} #t
3126 (logbit? 3 #b1101) @result{} #t
3127 (logbit? 4 #b1101) @result{} #f
3128 @end example
3129 @end deffn
3130
3131 \flognot
3132 @c snarfed from numbers.c:1102
3133 @deffn primitive lognot n
3134 Returns the integer which is the 2s-complement of the integer argument.
3135
3136 Example:
3137 @lisp
3138 (number->string (lognot #b10000000) 2)
3139 @result{} "-10000001"
3140 (number->string (lognot #b0) 2)
3141 @result{} "-1"
3142 @end lisp
3143 @end deffn
3144
3145 \finteger-expt
3146 @c snarfed from numbers.c:1118
3147 @deffn primitive integer-expt n k
3148 Returns @var{n} raised to the non-negative integer exponent @var{k}.
3149
3150 Example:
3151 @lisp
3152 (integer-expt 2 5)
3153 @result{} 32
3154 (integer-expt -3 3)
3155 @result{} -27
3156 @end lisp
3157 @end deffn
3158
3159 \fash
3160 @c snarfed from numbers.c:1166
3161 @deffn primitive ash n cnt
3162 The function ash performs an arithmetic shift left by @var{CNT}
3163 bits (or shift right, if @var{cnt} is negative).
3164 'Arithmetic' means, that the function does not guarantee to
3165 keep the bit structure of @var{n}, but rather guarantees that
3166 the result will always be rounded towards minus infinity.
3167 Therefore, the results of ash and a corresponding bitwise
3168 shift will differ if N is negative.
3169
3170 Formally, the function returns an integer equivalent to
3171 @code{(inexact->exact (floor (* @var{n} (expt 2 @var{cnt}))))}.
3172
3173 Example:
3174 @lisp
3175 (number->string (ash #b1 3) 2)
3176 @result{} "1000"
3177 (number->string (ash #b1010 -1) 2)
3178 @result{} "101"
3179 @end lisp
3180 @end deffn
3181
3182 \fbit-extract
3183 @c snarfed from numbers.c:1219
3184 @deffn primitive bit-extract n start end
3185 Returns the integer composed of the @var{start} (inclusive) through
3186 @var{end} (exclusive) bits of @var{n}. The @var{start}th bit becomes
3187 the 0-th bit in the result.@refill
3188
3189 Example:
3190 @lisp
3191 (number->string (bit-extract #b1101101010 0 4) 2)
3192 @result{} "1010"
3193 (number->string (bit-extract #b1101101010 4 9) 2)
3194 @result{} "10110"
3195 @end lisp
3196 @end deffn
3197
3198 \flogcount
3199 @c snarfed from numbers.c:1291
3200 @deffn primitive logcount n
3201 Returns the number of bits in integer @var{n}. If integer is positive,
3202 the 1-bits in its binary representation are counted. If negative, the
3203 0-bits in its two's-complement binary representation are counted. If 0,
3204 0 is returned.
3205
3206 Example:
3207 @lisp
3208 (logcount #b10101010)
3209 @result{} 4
3210 (logcount 0)
3211 @result{} 0
3212 (logcount -2)
3213 @result{} 1
3214 @end lisp
3215 @end deffn
3216
3217 \finteger-length
3218 @c snarfed from numbers.c:1342
3219 @deffn primitive integer-length n
3220 Returns the number of bits neccessary to represent @var{n}.
3221
3222 Example:
3223 @lisp
3224 (integer-length #b10101010)
3225 @result{} 8
3226 (integer-length 0)
3227 @result{} 0
3228 (integer-length #b1111)
3229 @result{} 4
3230 @end lisp
3231 @end deffn
3232
3233 \fnumber->string
3234 @c snarfed from numbers.c:2288
3235 @deffn primitive number->string n [radix]
3236 Return a string holding the external representation of the
3237 number @var{n} in the given @var{radix}. If @var{n} is
3238 inexact, a radix of 10 will be used.
3239 @end deffn
3240
3241 \fstring->number
3242 @c snarfed from numbers.c:2873
3243 @deffn primitive string->number string [radix]
3244 Returns a number of the maximally precise representation
3245 expressed by the given @var{string}. @var{radix} must be an
3246 exact integer, either 2, 8, 10, or 16. If supplied, @var{radix}
3247 is a default radix that may be overridden by an explicit radix
3248 prefix in @var{string} (e.g. "#o177"). If @var{radix} is not
3249 supplied, then the default radix is 10. If string is not a
3250 syntactically valid notation for a number, then
3251 @code{string->number} returns @code{#f}.
3252 @end deffn
3253
3254 \fnumber?
3255 @c snarfed from numbers.c:2940
3256 @deffn primitive number?
3257 scm_number_p
3258 @end deffn
3259
3260 \fcomplex?
3261 @c snarfed from numbers.c:2952
3262 @deffn primitive complex? x
3263 Return @code{#t} if @var{x} is a complex number, @code{#f}
3264 else. Note that the sets of real, rational and integer
3265 values form subsets of the set of complex numbers, i. e. the
3266 predicate will also be fulfilled if @var{x} is a real,
3267 rational or integer number.
3268 @end deffn
3269
3270 \freal?
3271 @c snarfed from numbers.c:2960
3272 @deffn primitive real?
3273 scm_real_p
3274 @end deffn
3275
3276 \frational?
3277 @c snarfed from numbers.c:2973
3278 @deffn primitive rational? x
3279 Return @code{#t} if @var{x} is a rational number, @code{#f}
3280 else. Note that the set of integer values forms a subset of
3281 the set of rational numbers, i. e. the predicate will also be
3282 fulfilled if @var{x} is an integer number. Real numbers
3283 will also satisfy this predicate, because of their limited
3284 precision.
3285 @end deffn
3286
3287 \finteger?
3288 @c snarfed from numbers.c:2994
3289 @deffn primitive integer? x
3290 Return @code{#t} if @var{x} is an integer number, @code{#f}
3291 else.
3292 @end deffn
3293
3294 \finexact?
3295 @c snarfed from numbers.c:3019
3296 @deffn primitive inexact? x
3297 Return @code{#t} if @var{x} is an inexact number, @code{#f}
3298 else.
3299 @end deffn
3300
3301 \f$expt
3302 @c snarfed from numbers.c:4071
3303 @deffn primitive $expt x y
3304 Return @var{x} raised to the power of @var{y}. This
3305 procedure does not accept complex arguments.
3306 @end deffn
3307
3308 \f$atan2
3309 @c snarfed from numbers.c:4087
3310 @deffn primitive $atan2 x y
3311 Return the arc tangent of the two arguments @var{x} and
3312 @var{y}. This is similar to calculating the arc tangent of
3313 @var{x} / @var{y}, except that the signs of both arguments
3314 are used to determine the quadrant of the result. This
3315 procedure does not accept complex arguments.
3316 @end deffn
3317
3318 \fmake-rectangular
3319 @c snarfed from numbers.c:4100
3320 @deffn primitive make-rectangular real imaginary
3321 Return a complex number constructed of the given @var{real} and
3322 @var{imaginary} parts.
3323 @end deffn
3324
3325 \fmake-polar
3326 @c snarfed from numbers.c:4113
3327 @deffn primitive make-polar x y
3328 Return the complex number @var{x} * e^(i * @var{y}).
3329 @end deffn
3330
3331 \finexact->exact
3332 @c snarfed from numbers.c:4231
3333 @deffn primitive inexact->exact z
3334 Returns an exact number that is numerically closest to @var{z}.
3335 @end deffn
3336
3337 \fclass-of
3338 @c snarfed from objects.c:88
3339 @deffn primitive class-of x
3340 Return the class of @var{x}.
3341 @end deffn
3342
3343 \fentity?
3344 @c snarfed from objects.c:359
3345 @deffn primitive entity? obj
3346 Return @code{#t} if @var{obj} is an entity.
3347 @end deffn
3348
3349 \foperator?
3350 @c snarfed from objects.c:368
3351 @deffn primitive operator? obj
3352 Return @code{#t} if @var{obj} is an operator.
3353 @end deffn
3354
3355 \fset-object-procedure!
3356 @c snarfed from objects.c:380
3357 @deffn primitive set-object-procedure! obj proc
3358 Return the object procedure of @var{obj} to @var{proc}.
3359 @var{obj} must be either an entity or an operator.
3360 @end deffn
3361
3362 \fmake-class-object
3363 @c snarfed from objects.c:440
3364 @deffn primitive make-class-object metaclass layout
3365 Create a new class object of class @var{metaclass}, with the
3366 slot layout specified by @var{layout}.
3367 @end deffn
3368
3369 \fmake-subclass-object
3370 @c snarfed from objects.c:455
3371 @deffn primitive make-subclass-object class layout
3372 Create a subclass object of @var{class}, with the slot layout
3373 specified by @var{layout}.
3374 @end deffn
3375
3376 \fobject-properties
3377 @c snarfed from objprop.c:62
3378 @deffn primitive object-properties obj
3379 @deffnx primitive procedure-properties obj
3380 Return @var{obj}'s property list.
3381 @end deffn
3382
3383 \fset-object-properties!
3384 @c snarfed from objprop.c:73
3385 @deffn primitive set-object-properties! obj plist
3386 @deffnx primitive set-procedure-properties! obj alist
3387 Set @var{obj}'s property list to @var{alist}.
3388 @end deffn
3389
3390 \fobject-property
3391 @c snarfed from objprop.c:85
3392 @deffn primitive object-property obj key
3393 @deffnx primitive procedure-property obj key
3394 Return the property of @var{obj} with name @var{key}.
3395 @end deffn
3396
3397 \fset-object-property!
3398 @c snarfed from objprop.c:98
3399 @deffn primitive set-object-property! obj key val
3400 @deffnx primitive set-procedure-property! obj key value
3401 In @var{obj}'s property list, set the property named @var{key} to
3402 @var{value}.
3403 @end deffn
3404
3405 \fcons
3406 @c snarfed from pairs.c:61
3407 @deffn primitive cons x y
3408 Returns a newly allocated pair whose car is @var{x} and whose cdr is
3409 @var{y}. The pair is guaranteed to be different (in the sense of
3410 @code{eqv?}) from every previously existing object.
3411 @end deffn
3412
3413 \fpair?
3414 @c snarfed from pairs.c:93
3415 @deffn primitive pair? x
3416 Returns @code{#t} if @var{x} is a pair; otherwise returns @code{#f}.
3417 @end deffn
3418
3419 \fset-car!
3420 @c snarfed from pairs.c:104
3421 @deffn primitive set-car! pair value
3422 Stores @var{value} in the car field of @var{pair}. The value returned
3423 by @code{set-car!} is unspecified.
3424 @end deffn
3425
3426 \fset-cdr!
3427 @c snarfed from pairs.c:117
3428 @deffn primitive set-cdr! pair value
3429 Stores @var{value} in the cdr field of @var{pair}. The value returned
3430 by @code{set-cdr!} is unspecified.
3431 @end deffn
3432
3433 \fchar-ready?
3434 @c snarfed from ports.c:246
3435 @deffn primitive char-ready? [port]
3436 Returns @code{#t} if a character is ready on input @var{port} and
3437 returns @code{#f} otherwise. If @code{char-ready?} returns @code{#t}
3438 then the next @code{read-char} operation on @var{port} is
3439 guaranteed not to hang. If @var{port} is a file port at end of
3440 file then @code{char-ready?} returns @code{#t}.
3441 @footnote{@code{char-ready?} exists to make it possible for a
3442 program to accept characters from interactive ports without getting
3443 stuck waiting for input. Any input editors associated with such ports
3444 must make sure that characters whose existence has been asserted by
3445 @code{char-ready?} cannot be rubbed out. If @code{char-ready?} were to
3446 return @code{#f} at end of file, a port at end of file would be
3447 indistinguishable from an interactive port that has no ready
3448 characters.}
3449 @end deffn
3450
3451 \fdrain-input
3452 @c snarfed from ports.c:312
3453 @deffn primitive drain-input port
3454 Drain @var{port}'s read buffers (including any pushed-back
3455 characters) and returns the content as a single string.
3456 @end deffn
3457
3458 \fcurrent-input-port
3459 @c snarfed from ports.c:339
3460 @deffn primitive current-input-port
3461 Return the current input port. This is the default port used
3462 by many input procedures. Initially, @code{current-input-port}
3463 returns the @dfn{standard input} in Unix and C terminology.
3464 @end deffn
3465
3466 \fcurrent-output-port
3467 @c snarfed from ports.c:351
3468 @deffn primitive current-output-port
3469 Return the current output port. This is the default port used
3470 by many output procedures. Initially,
3471 @code{current-output-port} returns the @dfn{standard output} in
3472 Unix and C terminology.
3473 @end deffn
3474
3475 \fcurrent-error-port
3476 @c snarfed from ports.c:361
3477 @deffn primitive current-error-port
3478 Return the port to which errors and warnings should be sent (the
3479 @dfn{standard error} in Unix and C terminology).
3480 @end deffn
3481
3482 \fcurrent-load-port
3483 @c snarfed from ports.c:371
3484 @deffn primitive current-load-port
3485 Return the current-load-port.
3486 The load port is used internally by @code{primitive-load}.
3487 @end deffn
3488
3489 \fset-current-input-port
3490 @c snarfed from ports.c:384
3491 @deffn primitive set-current-input-port port
3492 @deffnx primitive set-current-output-port port
3493 @deffnx primitive set-current-error-port port
3494 Change the ports returned by @code{current-input-port},
3495 @code{current-output-port} and @code{current-error-port}, respectively,
3496 so that they use the supplied @var{port} for input or output.
3497 @end deffn
3498
3499 \fset-current-output-port
3500 @c snarfed from ports.c:397
3501 @deffn primitive set-current-output-port port
3502 Set the current default output port to @var{port}.
3503 @end deffn
3504
3505 \fset-current-error-port
3506 @c snarfed from ports.c:411
3507 @deffn primitive set-current-error-port port
3508 Set the current default error port to @var{port}.
3509 @end deffn
3510
3511 \fport-revealed
3512 @c snarfed from ports.c:556
3513 @deffn primitive port-revealed port
3514 Returns the revealed count for @var{port}.
3515 @end deffn
3516
3517 \fset-port-revealed!
3518 @c snarfed from ports.c:569
3519 @deffn primitive set-port-revealed! port rcount
3520 Sets the revealed count for a port to a given value.
3521 The return value is unspecified.
3522 @end deffn
3523
3524 \fport-mode
3525 @c snarfed from ports.c:612
3526 @deffn primitive port-mode port
3527 Returns the port modes associated with the open port @var{port}. These
3528 will not necessarily be identical to the modes used when the port was
3529 opened, since modes such as "append" which are used only during
3530 port creation are not retained.
3531 @end deffn
3532
3533 \fclose-port
3534 @c snarfed from ports.c:649
3535 @deffn primitive close-port port
3536 Close the specified port object. Returns @code{#t} if it successfully
3537 closes a port or @code{#f} if it was already
3538 closed. An exception may be raised if an error occurs, for example
3539 when flushing buffered output.
3540 See also @ref{Ports and File Descriptors, close}, for a procedure
3541 which can close file descriptors.
3542 @end deffn
3543
3544 \fclose-input-port
3545 @c snarfed from ports.c:677
3546 @deffn primitive close-input-port port
3547 Close the specified input port object. The routine has no effect if
3548 the file has already been closed. An exception may be raised if an
3549 error occurs. The value returned is unspecified.
3550
3551 See also @ref{Ports and File Descriptors, close}, for a procedure
3552 which can close file descriptors.
3553 @end deffn
3554
3555 \fclose-output-port
3556 @c snarfed from ports.c:692
3557 @deffn primitive close-output-port port
3558 Close the specified output port object. The routine has no effect if
3559 the file has already been closed. An exception may be raised if an
3560 error occurs. The value returned is unspecified.
3561
3562 See also @ref{Ports and File Descriptors, close}, for a procedure
3563 which can close file descriptors.
3564 @end deffn
3565
3566 \fport-for-each
3567 @c snarfed from ports.c:709
3568 @deffn primitive port-for-each proc
3569 Apply @var{proc} to each port in the Guile port table
3570 in turn. The return value is unspecified. More specifically,
3571 @var{proc} is applied exactly once to every port that exists
3572 in the system at the time @var{port-for-each} is invoked.
3573 Changes to the port table while @var{port-for-each} is running
3574 have no effect as far as @var{port-for-each} is concerned.
3575 @end deffn
3576
3577 \fclose-all-ports-except
3578 @c snarfed from ports.c:752
3579 @deffn primitive close-all-ports-except . ports
3580 [DEPRECATED] Close all open file ports used by the interpreter
3581 except for those supplied as arguments. This procedure
3582 was intended to be used before an exec call to close file descriptors
3583 which are not needed in the new process. However it has the
3584 undesirable side-effect of flushing buffes, so it's deprecated.
3585 Use port-for-each instead.
3586 @end deffn
3587
3588 \finput-port?
3589 @c snarfed from ports.c:791
3590 @deffn primitive input-port? x
3591 Returns @code{#t} if @var{x} is an input port, otherwise returns
3592 @code{#f}. Any object satisfying this predicate also satisfies
3593 @code{port?}.
3594 @end deffn
3595
3596 \foutput-port?
3597 @c snarfed from ports.c:804
3598 @deffn primitive output-port? x
3599 Returns @code{#t} if @var{x} is an output port, otherwise returns
3600 @code{#f}. Any object satisfying this predicate also satisfies
3601 @code{port?}.
3602 @end deffn
3603
3604 \fport?
3605 @c snarfed from ports.c:819
3606 @deffn primitive port? x
3607 Returns a boolean indicating whether @var{x} is a port.
3608 Equivalent to @code{(or (input-port? @var{x}) (output-port?
3609 @var{x}))}.
3610 @end deffn
3611
3612 \fport-closed?
3613 @c snarfed from ports.c:828
3614 @deffn primitive port-closed? port
3615 Returns @code{#t} if @var{port} is closed or @code{#f} if it is open.
3616 @end deffn
3617
3618 \feof-object?
3619 @c snarfed from ports.c:839
3620 @deffn primitive eof-object? x
3621 Returns @code{#t} if @var{x} is an end-of-file object; otherwise
3622 returns @code{#f}.
3623 @end deffn
3624
3625 \fforce-output
3626 @c snarfed from ports.c:853
3627 @deffn primitive force-output [port]
3628 Flush the specified output port, or the current output port if @var{port}
3629 is omitted. The current output buffer contents are passed to the
3630 underlying port implementation (e.g., in the case of fports, the
3631 data will be written to the file and the output buffer will be cleared.)
3632 It has no effect on an unbuffered port.
3633
3634 The return value is unspecified.
3635 @end deffn
3636
3637 \fflush-all-ports
3638 @c snarfed from ports.c:871
3639 @deffn primitive flush-all-ports
3640 Equivalent to calling @code{force-output} on
3641 all open output ports. The return value is unspecified.
3642 @end deffn
3643
3644 \fread-char
3645 @c snarfed from ports.c:889
3646 @deffn primitive read-char [port]
3647 Returns the next character available from @var{port}, updating
3648 @var{port} to point to the following character. If no more
3649 characters are available, an end-of-file object is returned.
3650 @end deffn
3651
3652 \fpeek-char
3653 @c snarfed from ports.c:1205
3654 @deffn primitive peek-char [port]
3655 Returns the next character available from @var{port},
3656 @emph{without} updating @var{port} to point to the following
3657 character. If no more characters are available, an end-of-file object
3658 is returned.@footnote{The value returned by a call to @code{peek-char}
3659 is the same as the value that would have been returned by a call to
3660 @code{read-char} on the same port. The only difference is that the very
3661 next call to @code{read-char} or @code{peek-char} on that
3662 @var{port} will return the value returned by the preceding call to
3663 @code{peek-char}. In particular, a call to @code{peek-char} on an
3664 interactive port will hang waiting for input whenever a call to
3665 @code{read-char} would have hung.}
3666 @end deffn
3667
3668 \funread-char
3669 @c snarfed from ports.c:1226
3670 @deffn primitive unread-char cobj [port]
3671 Place @var{char} in @var{port} so that it will be read by the
3672 next read operation. If called multiple times, the unread characters
3673 will be read again in last-in first-out order. If @var{port} is
3674 not supplied, the current input port is used.
3675 @end deffn
3676
3677 \funread-string
3678 @c snarfed from ports.c:1249
3679 @deffn primitive unread-string str port
3680 Place the string @var{str} in @var{port} so that its characters will be
3681 read in subsequent read operations. If called multiple times, the
3682 unread characters will be read again in last-in first-out order. If
3683 @var{port} is not supplied, the current-input-port is used.
3684 @end deffn
3685
3686 \fseek
3687 @c snarfed from ports.c:1285
3688 @deffn primitive seek object offset whence
3689 Sets the current position of @var{fd/port} to the integer @var{offset},
3690 which is interpreted according to the value of @var{whence}.
3691
3692 One of the following variables should be supplied
3693 for @var{whence}:
3694 @defvar SEEK_SET
3695 Seek from the beginning of the file.
3696 @end defvar
3697 @defvar SEEK_CUR
3698 Seek from the current position.
3699 @end defvar
3700 @defvar SEEK_END
3701 Seek from the end of the file.
3702 @end defvar
3703
3704 If @var{fd/port} is a file descriptor, the underlying system call is
3705 @code{lseek}. @var{port} may be a string port.
3706
3707 The value returned is the new position in the file. This means that
3708 the current position of a port can be obtained using:
3709 @smalllisp
3710 (seek port 0 SEEK_CUR)
3711 @end smalllisp
3712 @end deffn
3713
3714 \ftruncate-file
3715 @c snarfed from ports.c:1326
3716 @deffn primitive truncate-file object [length]
3717 Truncates the object referred to by @var{obj} to at most @var{size} bytes.
3718 @var{obj} can be a string containing a file name or an integer file
3719 descriptor or a port. @var{size} may be omitted if @var{obj} is not
3720 a file name, in which case the truncation occurs at the current port.
3721 position.
3722
3723 The return value is unspecified.
3724 @end deffn
3725
3726 \fport-line
3727 @c snarfed from ports.c:1380
3728 @deffn primitive port-line port
3729 Return the current line number for @var{port}.
3730 @end deffn
3731
3732 \fset-port-line!
3733 @c snarfed from ports.c:1391
3734 @deffn primitive set-port-line! port line
3735 Set the current line number for @var{port} to @var{line}.
3736 @end deffn
3737
3738 \fport-column
3739 @c snarfed from ports.c:1412
3740 @deffn primitive port-column port
3741 @deffnx primitive port-line port
3742 Return the current column number or line number of @var{port},
3743 using the current input port if none is specified. If the number is
3744 unknown, the result is #f. Otherwise, the result is a 0-origin integer
3745 - i.e. the first character of the first line is line 0, column 0.
3746 (However, when you display a file position, for example in an error
3747 message, we recommend you add 1 to get 1-origin integers. This is
3748 because lines and column numbers traditionally start with 1, and that is
3749 what non-programmers will find most natural.)
3750 @end deffn
3751
3752 \fset-port-column!
3753 @c snarfed from ports.c:1425
3754 @deffn primitive set-port-column! port column
3755 @deffnx primitive set-port-line! port line
3756 Set the current column or line number of @var{port}, using the
3757 current input port if none is specified.
3758 @end deffn
3759
3760 \fport-filename
3761 @c snarfed from ports.c:1440
3762 @deffn primitive port-filename port
3763 Return the filename associated with @var{port}. This function returns
3764 the strings "standard input", "standard output" and "standard error"
3765 when called on the current input, output and error ports respectively.
3766 @end deffn
3767
3768 \fset-port-filename!
3769 @c snarfed from ports.c:1454
3770 @deffn primitive set-port-filename! port filename
3771 Change the filename associated with @var{port}, using the current input
3772 port if none is specified. Note that this does not change the port's
3773 source of data, but only the value that is returned by
3774 @code{port-filename} and reported in diagnostic output.
3775 @end deffn
3776
3777 \f%make-void-port
3778 @c snarfed from ports.c:1546
3779 @deffn primitive %make-void-port mode
3780 Create and return a new void port. A void port acts like
3781 /dev/null. The @var{mode} argument
3782 specifies the input/output modes for this port: see the
3783 documentation for @code{open-file} in @ref{File Ports}.
3784 @end deffn
3785
3786 \fpipe
3787 @c snarfed from posix.c:201
3788 @deffn primitive pipe
3789 Returns a newly created pipe: a pair of ports which are linked
3790 together on the local machine. The CAR is the input port and
3791 the CDR is the output port. Data written (and flushed) to the
3792 output port can be read from the input port.
3793 Pipes are commonly used for communication with a newly
3794 forked child process. The need to flush the output port
3795 can be avoided by making it unbuffered using @code{setvbuf}.
3796
3797 Writes occur atomically provided the size of the data in
3798 bytes is not greater than the value of @code{PIPE_BUF}
3799 Note that the output port is likely to block if too much data
3800 (typically equal to @code{PIPE_BUF}) has been written but not
3801 yet read from the input port
3802 @end deffn
3803
3804 \fgetgroups
3805 @c snarfed from posix.c:221
3806 @deffn primitive getgroups
3807 Returns a vector of integers representing the current supplimentary group IDs.
3808 @end deffn
3809
3810 \fgetpw
3811 @c snarfed from posix.c:254
3812 @deffn primitive getpw [user]
3813 Look up an entry in the user database. @var{obj} can be an integer,
3814 a string, or omitted, giving the behaviour of getpwuid, getpwnam
3815 or getpwent respectively.
3816 @end deffn
3817
3818 \fsetpw
3819 @c snarfed from posix.c:307
3820 @deffn primitive setpw [arg]
3821 If called with a true argument, initialize or reset the password data
3822 stream. Otherwise, close the stream. The @code{setpwent} and
3823 @code{endpwent} procedures are implemented on top of this.
3824 @end deffn
3825
3826 \fgetgr
3827 @c snarfed from posix.c:326
3828 @deffn primitive getgr [name]
3829 Look up an entry in the group database. @var{obj} can be an integer,
3830 a string, or omitted, giving the behaviour of getgrgid, getgrnam
3831 or getgrent respectively.
3832 @end deffn
3833
3834 \fsetgr
3835 @c snarfed from posix.c:367
3836 @deffn primitive setgr [arg]
3837 If called with a true argument, initialize or reset the group data
3838 stream. Otherwise, close the stream. The @code{setgrent} and
3839 @code{endgrent} procedures are implemented on top of this.
3840 @end deffn
3841
3842 \fkill
3843 @c snarfed from posix.c:403
3844 @deffn primitive kill pid sig
3845 Sends a signal to the specified process or group of processes.
3846
3847 @var{pid} specifies the processes to which the signal is sent:
3848
3849 @table @r
3850 @item @var{pid} greater than 0
3851 The process whose identifier is @var{pid}.
3852 @item @var{pid} equal to 0
3853 All processes in the current process group.
3854 @item @var{pid} less than -1
3855 The process group whose identifier is -@var{pid}
3856 @item @var{pid} equal to -1
3857 If the process is privileged, all processes except for some special
3858 system processes. Otherwise, all processes with the current effective
3859 user ID.
3860 @end table
3861
3862 @var{sig} should be specified using a variable corresponding to
3863 the Unix symbolic name, e.g.,
3864
3865 @defvar SIGHUP
3866 Hang-up signal.
3867 @end defvar
3868
3869 @defvar SIGINT
3870 Interrupt signal.
3871 @end defvar
3872 @end deffn
3873
3874 \fwaitpid
3875 @c snarfed from posix.c:451
3876 @deffn primitive waitpid pid [options]
3877 This procedure collects status information from a child process which
3878 has terminated or (optionally) stopped. Normally it will
3879 suspend the calling process until this can be done. If more than one
3880 child process is eligible then one will be chosen by the operating system.
3881
3882 The value of @var{pid} determines the behaviour:
3883
3884 @table @r
3885 @item @var{pid} greater than 0
3886 Request status information from the specified child process.
3887 @item @var{pid} equal to -1 or WAIT_ANY
3888 Request status information for any child process.
3889 @item @var{pid} equal to 0 or WAIT_MYPGRP
3890 Request status information for any child process in the current process
3891 group.
3892 @item @var{pid} less than -1
3893 Request status information for any child process whose process group ID
3894 is -@var{PID}.
3895 @end table
3896
3897 The @var{options} argument, if supplied, should be the bitwise OR of the
3898 values of zero or more of the following variables:
3899
3900 @defvar WNOHANG
3901 Return immediately even if there are no child processes to be collected.
3902 @end defvar
3903
3904 @defvar WUNTRACED
3905 Report status information for stopped processes as well as terminated
3906 processes.
3907 @end defvar
3908
3909 The return value is a pair containing:
3910
3911 @enumerate
3912 @item
3913 The process ID of the child process, or 0 if @code{WNOHANG} was
3914 specified and no process was collected.
3915 @item
3916 The integer status value.
3917 @end enumerate
3918 @end deffn
3919
3920 \fstatus:exit-val
3921 @c snarfed from posix.c:478
3922 @deffn primitive status:exit-val status
3923 Returns the exit status value, as would be
3924 set if a process ended normally through a
3925 call to @code{exit} or @code{_exit}, if any, otherwise @code{#f}.
3926 @end deffn
3927
3928 \fstatus:term-sig
3929 @c snarfed from posix.c:498
3930 @deffn primitive status:term-sig status
3931 Returns the signal number which terminated the
3932 process, if any, otherwise @code{#f}.
3933 @end deffn
3934
3935 \fstatus:stop-sig
3936 @c snarfed from posix.c:516
3937 @deffn primitive status:stop-sig status
3938 Returns the signal number which stopped the
3939 process, if any, otherwise @code{#f}.
3940 @end deffn
3941
3942 \fgetppid
3943 @c snarfed from posix.c:533
3944 @deffn primitive getppid
3945 Returns an integer representing the process ID of the parent process.
3946 @end deffn
3947
3948 \fgetuid
3949 @c snarfed from posix.c:544
3950 @deffn primitive getuid
3951 Returns an integer representing the current real user ID.
3952 @end deffn
3953
3954 \fgetgid
3955 @c snarfed from posix.c:555
3956 @deffn primitive getgid
3957 Returns an integer representing the current real group ID.
3958 @end deffn
3959
3960 \fgeteuid
3961 @c snarfed from posix.c:569
3962 @deffn primitive geteuid
3963 Returns an integer representing the current effective user ID.
3964 If the system does not support effective IDs, then the real ID
3965 is returned. @code{(feature? 'EIDs)} reports whether the system
3966 supports effective IDs.
3967 @end deffn
3968
3969 \fgetegid
3970 @c snarfed from posix.c:587
3971 @deffn primitive getegid
3972 Returns an integer representing the current effective group ID.
3973 If the system does not support effective IDs, then the real ID
3974 is returned. @code{(feature? 'EIDs)} reports whether the system
3975 supports effective IDs.
3976 @end deffn
3977
3978 \fsetuid
3979 @c snarfed from posix.c:603
3980 @deffn primitive setuid id
3981 Sets both the real and effective user IDs to the integer @var{id}, provided
3982 the process has appropriate privileges.
3983 The return value is unspecified.
3984 @end deffn
3985
3986 \fsetgid
3987 @c snarfed from posix.c:617
3988 @deffn primitive setgid id
3989 Sets both the real and effective group IDs to the integer @var{id}, provided
3990 the process has appropriate privileges.
3991 The return value is unspecified.
3992 @end deffn
3993
3994 \fseteuid
3995 @c snarfed from posix.c:633
3996 @deffn primitive seteuid id
3997 Sets the effective user ID to the integer @var{id}, provided the process
3998 has appropriate privileges. If effective IDs are not supported, the
3999 real ID is set instead -- @code{(feature? 'EIDs)} reports whether the
4000 system supports effective IDs.
4001 The return value is unspecified.
4002 @end deffn
4003
4004 \fsetegid
4005 @c snarfed from posix.c:657
4006 @deffn primitive setegid id
4007 Sets the effective group ID to the integer @var{id}, provided the process
4008 has appropriate privileges. If effective IDs are not supported, the
4009 real ID is set instead -- @code{(feature? 'EIDs)} reports whether the
4010 system supports effective IDs.
4011 The return value is unspecified.
4012 @end deffn
4013
4014 \fgetpgrp
4015 @c snarfed from posix.c:679
4016 @deffn primitive getpgrp
4017 Returns an integer representing the current process group ID.
4018 This is the POSIX definition, not BSD.
4019 @end deffn
4020
4021 \fsetpgid
4022 @c snarfed from posix.c:695
4023 @deffn primitive setpgid pid pgid
4024 Move the process @var{pid} into the process group @var{pgid}. @var{pid} or
4025 @var{pgid} must be integers: they can be zero to indicate the ID of the
4026 current process.
4027 Fails on systems that do not support job control.
4028 The return value is unspecified.
4029 @end deffn
4030
4031 \fsetsid
4032 @c snarfed from posix.c:714
4033 @deffn primitive setsid
4034 Creates a new session. The current process becomes the session leader
4035 and is put in a new process group. The process will be detached
4036 from its controlling terminal if it has one.
4037 The return value is an integer representing the new process group ID.
4038 @end deffn
4039
4040 \fttyname
4041 @c snarfed from posix.c:728
4042 @deffn primitive ttyname port
4043 Returns a string with the name of the serial terminal device underlying
4044 @var{port}.
4045 @end deffn
4046
4047 \fctermid
4048 @c snarfed from posix.c:751
4049 @deffn primitive ctermid
4050 Returns a string containing the file name of the controlling terminal
4051 for the current process.
4052 @end deffn
4053
4054 \ftcgetpgrp
4055 @c snarfed from posix.c:773
4056 @deffn primitive tcgetpgrp port
4057 Returns the process group ID of the foreground
4058 process group associated with the terminal open on the file descriptor
4059 underlying @var{port}.
4060
4061 If there is no foreground process group, the return value is a
4062 number greater than 1 that does not match the process group ID
4063 of any existing process group. This can happen if all of the
4064 processes in the job that was formerly the foreground job have
4065 terminated, and no other job has yet been moved into the
4066 foreground.
4067 @end deffn
4068
4069 \ftcsetpgrp
4070 @c snarfed from posix.c:797
4071 @deffn primitive tcsetpgrp port pgid
4072 Set the foreground process group ID for the terminal used by the file
4073 descriptor underlying @var{port} to the integer @var{pgid}.
4074 The calling process
4075 must be a member of the same session as @var{pgid} and must have the same
4076 controlling terminal. The return value is unspecified.
4077 @end deffn
4078
4079 \fexecl
4080 @c snarfed from posix.c:857
4081 @deffn primitive execl filename . args
4082 Executes the file named by @var{path} as a new process image.
4083 The remaining arguments are supplied to the process; from a C program
4084 they are accessable as the @code{argv} argument to @code{main}.
4085 Conventionally the first @var{arg} is the same as @var{path}.
4086 All arguments must be strings.
4087
4088 If @var{arg} is missing, @var{path} is executed with a null
4089 argument list, which may have system-dependent side-effects.
4090
4091 This procedure is currently implemented using the @code{execv} system
4092 call, but we call it @code{execl} because of its Scheme calling interface.
4093 @end deffn
4094
4095 \fexeclp
4096 @c snarfed from posix.c:878
4097 @deffn primitive execlp filename . args
4098 Similar to @code{execl}, however if
4099 @var{filename} does not contain a slash
4100 then the file to execute will be located by searching the
4101 directories listed in the @code{PATH} environment variable.
4102
4103 This procedure is currently implemented using the @code{execvp} system
4104 call, but we call it @code{execlp} because of its Scheme calling interface.
4105 @end deffn
4106
4107 \fexecle
4108 @c snarfed from posix.c:929
4109 @deffn primitive execle filename env . args
4110 Similar to @code{execl}, but the environment of the new process is
4111 specified by @var{env}, which must be a list of strings as returned by the
4112 @code{environ} procedure.
4113
4114 This procedure is currently implemented using the @code{execve} system
4115 call, but we call it @code{execle} because of its Scheme calling interface.
4116 @end deffn
4117
4118 \fprimitive-fork
4119 @c snarfed from posix.c:953
4120 @deffn primitive primitive-fork
4121 Creates a new "child" process by duplicating the current "parent" process.
4122 In the child the return value is 0. In the parent the return value is
4123 the integer process ID of the child.
4124
4125 This procedure has been renamed from @code{fork} to avoid a naming conflict
4126 with the scsh fork.
4127 @end deffn
4128
4129 \funame
4130 @c snarfed from posix.c:968
4131 @deffn primitive uname
4132 Returns an object with some information about the computer system the
4133 program is running on.
4134 @end deffn
4135
4136 \fenviron
4137 @c snarfed from posix.c:997
4138 @deffn primitive environ [env]
4139 If @var{env} is omitted, returns the current environment as a list of strings.
4140 Otherwise it sets the current environment, which is also the
4141 default environment for child processes, to the supplied list of strings.
4142 Each member of @var{env} should be of the form
4143 @code{NAME=VALUE} and values of @code{NAME} should not be duplicated.
4144 If @var{env} is supplied then the return value is unspecified.
4145 @end deffn
4146
4147 \ftmpnam
4148 @c snarfed from posix.c:1035
4149 @deffn primitive tmpnam
4150 tmpnam returns a name in the file system that does not match
4151 any existing file. However there is no guarantee that
4152 another process will not create the file after tmpnam
4153 is called. Care should be taken if opening the file,
4154 e.g., use the O_EXCL open flag or use @code{mkstemp!} instead.
4155 @end deffn
4156
4157 \fmkstemp!
4158 @c snarfed from posix.c:1058
4159 @deffn primitive mkstemp! tmpl
4160 mkstemp creates a new unique file in the file system and
4161 returns a new buffered port open for reading and writing to
4162 the file. @var{tmpl} is a string specifying where the
4163 file should be created: it must end with @code{XXXXXX}
4164 and will be changed in place to return the name of the
4165 temporary file.
4166 @end deffn
4167
4168 \futime
4169 @c snarfed from posix.c:1086
4170 @deffn primitive utime pathname [actime [modtime]]
4171 @code{utime} sets the access and modification times for
4172 the file named by @var{path}. If @var{actime} or @var{modtime}
4173 is not supplied, then the current time is used.
4174 @var{actime} and @var{modtime}
4175 must be integer time values as returned by the @code{current-time}
4176 procedure.
4177
4178 E.g.,
4179
4180 @smalllisp
4181 (utime "foo" (- (current-time) 3600))
4182 @end smalllisp
4183
4184 will set the access time to one hour in the past and the modification
4185 time to the current time.
4186 @end deffn
4187
4188 \faccess?
4189 @c snarfed from posix.c:1135
4190 @deffn primitive access? path how
4191 Returns @code{#t} if @var{path} corresponds to an existing
4192 file and the current process
4193 has the type of access specified by @var{how}, otherwise
4194 @code{#f}.
4195 @var{how} should be specified
4196 using the values of the variables listed below. Multiple values can
4197 be combined using a bitwise or, in which case @code{#t} will only
4198 be returned if all accesses are granted.
4199
4200 Permissions are checked using the real id of the current process,
4201 not the effective id, although it's the effective id which determines
4202 whether the access would actually be granted.
4203
4204 @defvar R_OK
4205 test for read permission.
4206 @end defvar
4207 @defvar W_OK
4208 test for write permission.
4209 @end defvar
4210 @defvar X_OK
4211 test for execute permission.
4212 @end defvar
4213 @defvar F_OK
4214 test for existence of the file.
4215 @end defvar
4216 @end deffn
4217
4218 \fgetpid
4219 @c snarfed from posix.c:1150
4220 @deffn primitive getpid
4221 Returns an integer representing the current process ID.
4222 @end deffn
4223
4224 \fputenv
4225 @c snarfed from posix.c:1167
4226 @deffn primitive putenv str
4227 Modifies the environment of the current process, which is
4228 also the default environment inherited by child processes.
4229
4230 If @var{string} is of the form @code{NAME=VALUE} then it will be written
4231 directly into the environment, replacing any existing environment string
4232 with
4233 name matching @code{NAME}. If @var{string} does not contain an equal
4234 sign, then any existing string with name matching @var{string} will
4235 be removed.
4236
4237 The return value is unspecified.
4238 @end deffn
4239
4240 \fsetlocale
4241 @c snarfed from posix.c:1198
4242 @deffn primitive setlocale category [locale]
4243 If @var{locale} is omitted, returns the current value of the specified
4244 locale category
4245 as a system-dependent string.
4246 @var{category} should be specified using the values @code{LC_COLLATE},
4247 @code{LC_ALL} etc.
4248
4249 Otherwise the specified locale category is set to
4250 the string @var{locale}
4251 and the new value is returned as a system-dependent string. If @var{locale}
4252 is an empty string, the locale will be set using envirionment variables.
4253 @end deffn
4254
4255 \fmknod
4256 @c snarfed from posix.c:1239
4257 @deffn primitive mknod path type perms dev
4258 Creates a new special file, such as a file corresponding to a device.
4259 @var{path} specifies the name of the file. @var{type} should
4260 be one of the following symbols:
4261 regular, directory, symlink, block-special, char-special,
4262 fifo, or socket. @var{perms} (an integer) specifies the file permissions.
4263 @var{dev} (an integer) specifies which device the special file refers
4264 to. Its exact interpretation depends on the kind of special file
4265 being created.
4266
4267 E.g.,
4268 @example
4269 (mknod "/dev/fd0" 'block-special #o660 (+ (* 2 256) 2))
4270 @end example
4271
4272 The return value is unspecified.
4273 @end deffn
4274
4275 \fnice
4276 @c snarfed from posix.c:1286
4277 @deffn primitive nice incr
4278 Increment the priority of the current process by @var{incr}. A higher
4279 priority value means that the process runs less often.
4280 The return value is unspecified.
4281 @end deffn
4282
4283 \fsync
4284 @c snarfed from posix.c:1301
4285 @deffn primitive sync
4286 Flush the operating system disk buffers.
4287 The return value is unspecified.
4288 @end deffn
4289
4290 \fcrypt
4291 @c snarfed from posix.c:1314
4292 @deffn primitive crypt key salt
4293 Encrypt @var{key} using @var{salt} as the salt value to the
4294 crypt(3) library call
4295 @end deffn
4296
4297 \fchroot
4298 @c snarfed from posix.c:1337
4299 @deffn primitive chroot path
4300 Change the root directory to that specified in @var{path}.
4301 This directory will be used for path names beginning with
4302 @file{/}. The root directory is inherited by all children
4303 of the current process. Only the superuser may change the
4304 root directory.
4305 @end deffn
4306
4307 \fgetlogin
4308 @c snarfed from posix.c:1355
4309 @deffn primitive getlogin
4310 Return a string containing the name of the user logged in on
4311 the controlling terminal of the process, or @code{#f} if this
4312 information cannot be obtained.
4313 @end deffn
4314
4315 \fcuserid
4316 @c snarfed from posix.c:1373
4317 @deffn primitive cuserid
4318 Return a string containing a user name associated with the
4319 effective user id of the process. Return @code{#f} if this
4320 information cannot be obtained.
4321 @end deffn
4322
4323 \fgetpriority
4324 @c snarfed from posix.c:1398
4325 @deffn primitive getpriority which who
4326 Return the scheduling priority of the process, process group
4327 or user, as indicated by @var{which} and @var{who}. @var{which}
4328 is one of the variables @code{PRIO_PROCESS}, @code{PRIO_PGRP}
4329 or @code{PRIO_USER}, and @var{who} is interpreted relative to
4330 @var{which} (a process identifier for @code{PRIO_PROCESS},
4331 process group identifier for @code{PRIO_PGRP}, and a user
4332 identifier for @code{PRIO_USER}. A zero value of @var{who}
4333 denotes the current process, process group, or user. Return
4334 the highest priority (lowest numerical value) of any of the
4335 specified processes.
4336 @end deffn
4337
4338 \fsetpriority
4339 @c snarfed from posix.c:1432
4340 @deffn primitive setpriority which who prio
4341 Set the scheduling priority of the process, process group
4342 or user, as indicated by @var{which} and @var{who}. @var{which}
4343 is one of the variables @code{PRIO_PROCESS}, @code{PRIO_PGRP}
4344 or @code{PRIO_USER}, and @var{who} is interpreted relative to
4345 @var{which} (a process identifier for @code{PRIO_PROCESS},
4346 process group identifier for @code{PRIO_PGRP}, and a user
4347 identifier for @code{PRIO_USER}. A zero value of @var{who}
4348 denotes the current process, process group, or user.
4349 @var{prio} is a value in the range -20 and 20, the default
4350 priority is 0; lower priorities cause more favorable
4351 scheduling. Sets the priority of all of the specified
4352 processes. Only the super-user may lower priorities.
4353 The return value is not specified.
4354 @end deffn
4355
4356 \fgetpass
4357 @c snarfed from posix.c:1457
4358 @deffn primitive getpass prompt
4359 Display @var{prompt} to the standard error output and read
4360 a password from @file{/dev/tty}. If this file is not
4361 accessible, it reads from standard input. The password may be
4362 up to 127 characters in length. Additional characters and the
4363 terminating newline character are discarded. While reading
4364 the password, echoing and the generation of signals by special
4365 characters is disabled.
4366 @end deffn
4367
4368 \fflock
4369 @c snarfed from posix.c:1496
4370 @deffn primitive flock file operation
4371 Apply or remove an advisory lock on an open file.
4372 @var{operation} specifies the action to be done:
4373 @table @code
4374 @item LOCK_SH
4375 Shared lock. More than one process may hold a shared lock
4376 for a given file at a given time.
4377 @item LOCK_EX
4378 Exclusive lock. Only one process may hold an exclusive lock
4379 for a given file at a given time.
4380 @item LOCK_UN
4381 Unlock the file.
4382 @item LOCK_NB
4383 Don't block when locking. May be specified by bitwise OR'ing
4384 it to one of the other operations.
4385 @end table
4386 The return value is not specified. @var{file} may be an open
4387 file descriptor or an open file descriptior port.
4388 @end deffn
4389
4390 \fsethostname
4391 @c snarfed from posix.c:1522
4392 @deffn primitive sethostname name
4393 Set the host name of the current processor to @var{name}. May
4394 only be used by the superuser. The return value is not
4395 specified.
4396 @end deffn
4397
4398 \fgethostname
4399 @c snarfed from posix.c:1538
4400 @deffn primitive gethostname
4401 Return the host name of the current processor.
4402 @end deffn
4403
4404 \fprint-options-interface
4405 @c snarfed from print.c:142
4406 @deffn primitive print-options-interface [setting]
4407 Option interface for the print options. Instead of using
4408 this procedure directly, use the procedures
4409 @code{print-enable}, @code{print-disable}, @code{print-set!}
4410 and @code{print-options}.
4411 @end deffn
4412
4413 \fsimple-format
4414 @c snarfed from print.c:980
4415 @deffn primitive simple-format destination message . args
4416 Write @var{message} to @var{destination}, defaulting to
4417 the current output port.
4418 @var{message} can contain @code{~A} (was @code{%s}) and
4419 @code{~S} (was @code{%S}) escapes. When printed,
4420 the escapes are replaced with corresponding members of
4421 @var{ARGS}:
4422 @code{~A} formats using @code{display} and @code{~S} formats
4423 using @code{write}.
4424 If @var{destination} is @code{#t}, then use the current output
4425 port, if @var{destination} is @code{#f}, then return a string
4426 containing the formatted text. Does not add a trailing newline.
4427 @end deffn
4428
4429 \fnewline
4430 @c snarfed from print.c:1045
4431 @deffn primitive newline [port]
4432 Send a newline to @var{port}.
4433 @end deffn
4434
4435 \fwrite-char
4436 @c snarfed from print.c:1060
4437 @deffn primitive write-char chr [port]
4438 Send character @var{chr} to @var{port}.
4439 @end deffn
4440
4441 \fport-with-print-state
4442 @c snarfed from print.c:1114
4443 @deffn primitive port-with-print-state port pstate
4444 Create a new port which behaves like @var{port}, but with an
4445 included print state @var{pstate}.
4446 @end deffn
4447
4448 \fget-print-state
4449 @c snarfed from print.c:1129
4450 @deffn primitive get-print-state port
4451 Return the print state of the port @var{port}. If @var{port}
4452 has no associated print state, @code{#f} is returned.
4453 @end deffn
4454
4455 \fprocedure-properties
4456 @c snarfed from procprop.c:180
4457 @deffn primitive procedure-properties proc
4458 Return @var{obj}'s property list.
4459 @end deffn
4460
4461 \fset-procedure-properties!
4462 @c snarfed from procprop.c:193
4463 @deffn primitive set-procedure-properties! proc new_val
4464 Set @var{obj}'s property list to @var{alist}.
4465 @end deffn
4466
4467 \fprocedure-property
4468 @c snarfed from procprop.c:206
4469 @deffn primitive procedure-property p k
4470 Return the property of @var{obj} with name @var{key}.
4471 @end deffn
4472
4473 \fset-procedure-property!
4474 @c snarfed from procprop.c:229
4475 @deffn primitive set-procedure-property! p k v
4476 In @var{obj}'s property list, set the property named @var{key} to
4477 @var{value}.
4478 @end deffn
4479
4480 \fprocedure?
4481 @c snarfed from procs.c:196
4482 @deffn primitive procedure? obj
4483 Return @code{#t} if @var{obj} is a procedure.
4484 @end deffn
4485
4486 \fclosure?
4487 @c snarfed from procs.c:223
4488 @deffn primitive closure? obj
4489 Return @code{#t} if @var{obj} is a closure.
4490 @end deffn
4491
4492 \fthunk?
4493 @c snarfed from procs.c:232
4494 @deffn primitive thunk? obj
4495 Return @code{#t} if @var{obj} is a thunk.
4496 @end deffn
4497
4498 \fprocedure-documentation
4499 @c snarfed from procs.c:283
4500 @deffn primitive procedure-documentation proc
4501 Return the documentation string associated with @code{proc}. By
4502 convention, if a procedure contains more than one expression and the
4503 first expression is a string constant, that string is assumed to contain
4504 documentation for that procedure.
4505 @end deffn
4506
4507 \fprocedure-with-setter?
4508 @c snarfed from procs.c:319
4509 @deffn primitive procedure-with-setter? obj
4510 Return @code{#t} if @var{obj} is a procedure with an
4511 associated setter procedure.
4512 @end deffn
4513
4514 \fmake-procedure-with-setter
4515 @c snarfed from procs.c:329
4516 @deffn primitive make-procedure-with-setter procedure setter
4517 Create a new procedure which behaves like @var{procedure}, but
4518 with the associated setter @var{setter}.
4519 @end deffn
4520
4521 \fprocedure
4522 @c snarfed from procs.c:348
4523 @deffn primitive procedure proc
4524 Return the procedure of @var{proc}, which must be either a
4525 procedure with setter, or an operator struct.
4526 @end deffn
4527
4528 \fprimitive-make-property
4529 @c snarfed from properties.c:66
4530 @deffn primitive primitive-make-property not_found_proc
4531 Create a @dfn{property token} that can be used with
4532 @code{primitive-property-ref} and @code{primitive-property-set!}.
4533 See @code{primitive-property-ref} for the significance of
4534 @var{not_found_proc}.
4535 @end deffn
4536
4537 \fprimitive-property-ref
4538 @c snarfed from properties.c:83
4539 @deffn primitive primitive-property-ref prop obj
4540 Return the property @var{prop} of @var{obj}. When no value
4541 has yet been associated with @var{prop} and @var{obj}, call
4542 @var{not-found-proc} instead (see @code{primitive-make-property})
4543 and use its return value. That value is also associated with
4544 @var{obj} via @code{primitive-property-set!}. When
4545 @var{not-found-proc} is @code{#f}, use @code{#f} as the
4546 default value of @var{prop}.
4547 @end deffn
4548
4549 \fprimitive-property-set!
4550 @c snarfed from properties.c:111
4551 @deffn primitive primitive-property-set! prop obj val
4552 Associate @var{code} with @var{prop} and @var{obj}.
4553 @end deffn
4554
4555 \fprimitive-property-del!
4556 @c snarfed from properties.c:131
4557 @deffn primitive primitive-property-del! prop obj
4558 Remove any value associated with @var{prop} and @var{obj}.
4559 @end deffn
4560
4561 \farray-fill!
4562 @c snarfed from ramap.c:467
4563 @deffn primitive array-fill! ra fill
4564 Stores @var{fill} in every element of @var{array}. The value returned
4565 is unspecified.
4566 @end deffn
4567
4568 \farray-copy-in-order!
4569 @c snarfed from ramap.c:832
4570 @deffn primitive array-copy-in-order!
4571 scm_array_copy_x
4572 @end deffn
4573
4574 \farray-copy!
4575 @c snarfed from ramap.c:841
4576 @deffn primitive array-copy! src dst
4577 @deffnx primitive array-copy-in-order! src dst
4578 Copies every element from vector or array @var{source} to the
4579 corresponding element of @var{destination}. @var{destination} must have
4580 the same rank as @var{source}, and be at least as large in each
4581 dimension. The order is unspecified.
4582 @end deffn
4583
4584 \farray-map-in-order!
4585 @c snarfed from ramap.c:1515
4586 @deffn primitive array-map-in-order!
4587 scm_array_map_x
4588 @end deffn
4589
4590 \farray-map!
4591 @c snarfed from ramap.c:1526
4592 @deffn primitive array-map! ra0 proc . lra
4593 @deffnx primitive array-map-in-order! ra0 proc . lra
4594 @var{array1}, @dots{} must have the same number of dimensions as
4595 @var{array0} and have a range for each index which includes the range
4596 for the corresponding index in @var{array0}. @var{proc} is applied to
4597 each tuple of elements of @var{array1} @dots{} and the result is stored
4598 as the corresponding element in @var{array0}. The value returned is
4599 unspecified. The order of application is unspecified.
4600 @end deffn
4601
4602 \farray-for-each
4603 @c snarfed from ramap.c:1673
4604 @deffn primitive array-for-each proc ra0 . lra
4605 @var{proc} is applied to each tuple of elements of @var{array0} @dots{}
4606 in row-major order. The value returned is unspecified.
4607 @end deffn
4608
4609 \farray-index-map!
4610 @c snarfed from ramap.c:1701
4611 @deffn primitive array-index-map! ra proc
4612 applies @var{proc} to the indices of each element of @var{array} in
4613 turn, storing the result in the corresponding element. The value
4614 returned and the order of application are unspecified.
4615
4616 One can implement @var{array-indexes} as
4617 @example
4618 (define (array-indexes array)
4619 (let ((ra (apply make-array #f (array-shape array))))
4620 (array-index-map! ra (lambda x x))
4621 ra))
4622 @end example
4623 Another example:
4624 @example
4625 (define (apl:index-generator n)
4626 (let ((v (make-uniform-vector n 1)))
4627 (array-index-map! v (lambda (i) i))
4628 v))
4629 @end example
4630 @end deffn
4631
4632 \frandom
4633 @c snarfed from random.c:370
4634 @deffn primitive random n [state]
4635 Return a number in [0,N).
4636 Accepts a positive integer or real n and returns a
4637 number of the same type between zero (inclusive) and
4638 N (exclusive). The values returned have a uniform
4639 distribution.
4640 The optional argument @var{state} must be of the type produced
4641 by @code{seed->random-state}. It defaults to the value of the
4642 variable @var{*random-state*}. This object is used to maintain
4643 the state of the pseudo-random-number generator and is altered
4644 as a side effect of the random operation.
4645 @end deffn
4646
4647 \fcopy-random-state
4648 @c snarfed from random.c:393
4649 @deffn primitive copy-random-state [state]
4650 Return a copy of the random state @var{state}.
4651 @end deffn
4652
4653 \fseed->random-state
4654 @c snarfed from random.c:405
4655 @deffn primitive seed->random-state seed
4656 Return a new random state using @var{seed}.
4657 @end deffn
4658
4659 \frandom:uniform
4660 @c snarfed from random.c:418
4661 @deffn primitive random:uniform [state]
4662 Returns a uniformly distributed inexact real random number in [0,1).
4663 @end deffn
4664
4665 \frandom:normal
4666 @c snarfed from random.c:433
4667 @deffn primitive random:normal [state]
4668 Returns an inexact real in a normal distribution.
4669 The distribution used has mean 0 and standard deviation 1.
4670 For a normal distribution with mean m and standard deviation
4671 d use @code{(+ m (* d (random:normal)))}.
4672 @end deffn
4673
4674 \frandom:solid-sphere!
4675 @c snarfed from random.c:489
4676 @deffn primitive random:solid-sphere! v [state]
4677 Fills vect with inexact real random numbers
4678 the sum of whose squares is less than 1.0.
4679 Thinking of vect as coordinates in space of
4680 dimension n = (vector-length vect), the coordinates
4681 are uniformly distributed within the unit n-shere.
4682 The sum of the squares of the numbers is returned.
4683 @end deffn
4684
4685 \frandom:hollow-sphere!
4686 @c snarfed from random.c:512
4687 @deffn primitive random:hollow-sphere! v [state]
4688 Fills vect with inexact real random numbers
4689 the sum of whose squares is equal to 1.0.
4690 Thinking of vect as coordinates in space of
4691 dimension n = (vector-length vect), the coordinates
4692 are uniformly distributed over the surface of the
4693 unit n-shere.
4694 @end deffn
4695
4696 \frandom:normal-vector!
4697 @c snarfed from random.c:530
4698 @deffn primitive random:normal-vector! v [state]
4699 Fills vect with inexact real random numbers that are
4700 independent and standard normally distributed
4701 (i.e., with mean 0 and variance 1).
4702 @end deffn
4703
4704 \frandom:exp
4705 @c snarfed from random.c:554
4706 @deffn primitive random:exp [state]
4707 Returns an inexact real in an exponential distribution with mean 1.
4708 For an exponential distribution with mean u use (* u (random:exp)).
4709 @end deffn
4710
4711 \f%read-delimited!
4712 @c snarfed from rdelim.c:78
4713 @deffn primitive %read-delimited! delims str gobble [port [start [end]]]
4714 Read characters from @var{port} into @var{str} until one of the
4715 characters in the @var{delims} string is encountered. If
4716 @var{gobble} is true, discard the delimiter character;
4717 otherwise, leave it in the input stream for the next read. If
4718 @var{port} is not specified, use the value of
4719 @code{(current-input-port)}. If @var{start} or @var{end} are
4720 specified, store data only into the substring of @var{str}
4721 bounded by @var{start} and @var{end} (which default to the
4722 beginning and end of the string, respectively).
4723 Return a pair consisting of the delimiter that terminated the
4724 string and the number of characters read. If reading stopped
4725 at the end of file, the delimiter returned is the
4726 @var{eof-object}; if the string was filled without encountering
4727 a delimiter, this value is @code{#f}.
4728 @end deffn
4729
4730 \f%read-line
4731 @c snarfed from rdelim.c:223
4732 @deffn primitive %read-line [port]
4733 Read a newline-terminated line from @var{port}, allocating storage as
4734 necessary. The newline terminator (if any) is removed from the string,
4735 and a pair consisting of the line and its delimiter is returned. The
4736 delimiter may be either a newline or the @var{eof-object}; if
4737 @code{%read-line} is called at the end of file, it returns the pair
4738 @code{(#<eof> . #<eof>)}.
4739 @end deffn
4740
4741 \fwrite-line
4742 @c snarfed from rdelim.c:277
4743 @deffn primitive write-line obj [port]
4744 Display @var{obj} and a newline character to @var{port}. If @var{port}
4745 is not specified, @code{(current-output-port)} is used. This function
4746 is equivalent to:
4747
4748 @smalllisp
4749 (display obj [port])
4750 (newline [port])
4751 @end smalllisp
4752 @end deffn
4753
4754 \fread-options-interface
4755 @c snarfed from read.c:84
4756 @deffn primitive read-options-interface [setting]
4757 Option interface for the read options. Instead of using
4758 this procedure directly, use the procedures @code{read-enable},
4759 @code{read-disable}, @code{read-set!} and @var{read-options}.
4760 @end deffn
4761
4762 \fread
4763 @c snarfed from read.c:104
4764 @deffn primitive read [port]
4765 Read an s-expression from the input port @var{port}, or from
4766 the current input port if @var{port} is not specified.
4767 Any whitespace before the next token is discarded.
4768 @end deffn
4769
4770 \fread-hash-extend
4771 @c snarfed from read.c:746
4772 @deffn primitive read-hash-extend chr proc
4773 Install the procedure @var{proc} for reading expressions
4774 starting with the character sequence @code{#} and @var{chr}.
4775 @var{proc} will be called with two arguments: the character
4776 @var{chr} and the port to read further data from. The object
4777 returned will be the return value of @code{read}.
4778 @end deffn
4779
4780 \fregexp?
4781 @c snarfed from regex-posix.c:139
4782 @deffn primitive regexp? x
4783 Return @code{#t} if @var{obj} is a compiled regular expression, or
4784 @code{#f} otherwise.
4785 @end deffn
4786
4787 \fmake-regexp
4788 @c snarfed from regex-posix.c:179
4789 @deffn primitive make-regexp pat . flags
4790 Compile the regular expression described by @var{str}, and return the
4791 compiled regexp structure. If @var{str} does not describe a legal
4792 regular expression, @code{make-regexp} throws a
4793 @code{regular-expression-syntax} error.
4794
4795 The @var{flag} arguments change the behavior of the compiled regexp.
4796 The following flags may be supplied:
4797
4798 @table @code
4799 @item regexp/icase
4800 Consider uppercase and lowercase letters to be the same when matching.
4801
4802 @item regexp/newline
4803 If a newline appears in the target string, then permit the @samp{^} and
4804 @samp{$} operators to match immediately after or immediately before the
4805 newline, respectively. Also, the @samp{.} and @samp{[^...]} operators
4806 will never match a newline character. The intent of this flag is to
4807 treat the target string as a buffer containing many lines of text, and
4808 the regular expression as a pattern that may match a single one of those
4809 lines.
4810
4811 @item regexp/basic
4812 Compile a basic (``obsolete'') regexp instead of the extended
4813 (``modern'') regexps that are the default. Basic regexps do not
4814 consider @samp{|}, @samp{+} or @samp{?} to be special characters, and
4815 require the @samp{@{...@}} and @samp{(...)} metacharacters to be
4816 backslash-escaped (@pxref{Backslash Escapes}). There are several other
4817 differences between basic and extended regular expressions, but these
4818 are the most significant.
4819
4820 @item regexp/extended
4821 Compile an extended regular expression rather than a basic regexp. This
4822 is the default behavior; this flag will not usually be needed. If a
4823 call to @code{make-regexp} includes both @code{regexp/basic} and
4824 @code{regexp/extended} flags, the one which comes last will override
4825 the earlier one.
4826 @end table
4827 @end deffn
4828
4829 \fregexp-exec
4830 @c snarfed from regex-posix.c:226
4831 @deffn primitive regexp-exec rx str [start [flags]]
4832 Match the compiled regular expression @var{regexp} against @code{str}.
4833 If the optional integer @var{start} argument is provided, begin matching
4834 from that position in the string. Return a match structure describing
4835 the results of the match, or @code{#f} if no match could be found.
4836 @end deffn
4837
4838 \fcall-with-dynamic-root
4839 @c snarfed from root.c:358
4840 @deffn primitive call-with-dynamic-root thunk handler
4841 Evaluate @code{(thunk)} in a new dynamic context, returning its value.
4842
4843 If an error occurs during evaluation, apply @var{handler} to the
4844 arguments to the throw, just as @code{throw} would. If this happens,
4845 @var{handler} is called outside the scope of the new root -- it is
4846 called in the same dynamic context in which
4847 @code{call-with-dynamic-root} was evaluated.
4848
4849 If @var{thunk} captures a continuation, the continuation is rooted at
4850 the call to @var{thunk}. In particular, the call to
4851 @code{call-with-dynamic-root} is not captured. Therefore,
4852 @code{call-with-dynamic-root} always returns at most one time.
4853
4854 Before calling @var{thunk}, the dynamic-wind chain is un-wound back to
4855 the root and a new chain started for @var{thunk}. Therefore, this call
4856 may not do what you expect:
4857
4858 @example
4859 ;; Almost certainly a bug:
4860 (with-output-to-port
4861 some-port
4862
4863 (lambda ()
4864 (call-with-dynamic-root
4865 (lambda ()
4866 (display 'fnord)
4867 (newline))
4868 (lambda (errcode) errcode))))
4869 @end example
4870
4871 The problem is, on what port will @samp{fnord} be displayed? You
4872 might expect that because of the @code{with-output-to-port} that
4873 it will be displayed on the port bound to @code{some-port}. But it
4874 probably won't -- before evaluating the thunk, dynamic winds are
4875 unwound, including those created by @code{with-output-to-port}.
4876 So, the standard output port will have been re-set to its default value
4877 before @code{display} is evaluated.
4878
4879 (This function was added to Guile mostly to help calls to functions in C
4880 libraries that can not tolerate non-local exits or calls that return
4881 multiple times. If such functions call back to the interpreter, it should
4882 be under a new dynamic root.)
4883 @end deffn
4884
4885 \fdynamic-root
4886 @c snarfed from root.c:371
4887 @deffn primitive dynamic-root
4888 Return an object representing the current dynamic root.
4889
4890 These objects are only useful for comparison using @code{eq?}.
4891 They are currently represented as numbers, but your code should
4892 in no way depend on this.
4893 @end deffn
4894
4895 \fsigaction
4896 @c snarfed from scmsigs.c:201
4897 @deffn primitive sigaction signum [handler [flags]]
4898 Install or report the signal handler for a specified signal.
4899
4900 @var{signum} is the signal number, which can be specified using the value
4901 of variables such as @code{SIGINT}.
4902
4903 If @var{action} is omitted, @code{sigaction} returns a pair: the
4904 CAR is the current
4905 signal hander, which will be either an integer with the value @code{SIG_DFL}
4906 (default action) or @code{SIG_IGN} (ignore), or the Scheme procedure which
4907 handles the signal, or @code{#f} if a non-Scheme procedure handles the
4908 signal. The CDR contains the current @code{sigaction} flags for the handler.
4909
4910 If @var{action} is provided, it is installed as the new handler for
4911 @var{signum}. @var{action} can be a Scheme procedure taking one
4912 argument, or the value of @code{SIG_DFL} (default action) or
4913 @code{SIG_IGN} (ignore), or @code{#f} to restore whatever signal handler
4914 was installed before @code{sigaction} was first used. Flags can
4915 optionally be specified for the new handler (@code{SA_RESTART} will
4916 always be added if it's available and the system is using restartable
4917 system calls.) The return value is a pair with information about the
4918 old handler as described above.
4919
4920 This interface does not provide access to the "signal blocking"
4921 facility. Maybe this is not needed, since the thread support may
4922 provide solutions to the problem of consistent access to data
4923 structures.
4924 @end deffn
4925
4926 \frestore-signals
4927 @c snarfed from scmsigs.c:360
4928 @deffn primitive restore-signals
4929 Return all signal handlers to the values they had before any call to
4930 @code{sigaction} was made. The return value is unspecified.
4931 @end deffn
4932
4933 \falarm
4934 @c snarfed from scmsigs.c:399
4935 @deffn primitive alarm i
4936 Set a timer to raise a @code{SIGALRM} signal after the specified
4937 number of seconds (an integer). It's advisable to install a signal
4938 handler for
4939 @code{SIGALRM} beforehand, since the default action is to terminate
4940 the process.
4941
4942 The return value indicates the time remaining for the previous alarm,
4943 if any. The new value replaces the previous alarm. If there was
4944 no previous alarm, the return value is zero.
4945 @end deffn
4946
4947 \fpause
4948 @c snarfed from scmsigs.c:414
4949 @deffn primitive pause
4950 Pause the current process (thread?) until a signal arrives whose
4951 action is to either terminate the current process or invoke a
4952 handler procedure. The return value is unspecified.
4953 @end deffn
4954
4955 \fsleep
4956 @c snarfed from scmsigs.c:427
4957 @deffn primitive sleep i
4958 Wait for the given number of seconds (an integer) or until a signal
4959 arrives. The return value is zero if the time elapses or the number
4960 of seconds remaining otherwise.
4961 @end deffn
4962
4963 \fusleep
4964 @c snarfed from scmsigs.c:445
4965 @deffn primitive usleep i
4966 Sleep for I microseconds. @code{usleep} is not available on
4967 all platforms.
4968 @end deffn
4969
4970 \fraise
4971 @c snarfed from scmsigs.c:475
4972 @deffn primitive raise sig
4973 Sends a specified signal @var{sig} to the current process, where
4974 @var{sig} is as described for the kill procedure.
4975 @end deffn
4976
4977 \fsystem
4978 @c snarfed from simpos.c:76
4979 @deffn primitive system [cmd]
4980 Executes @var{cmd} using the operating system's "command processor".
4981 Under Unix this is usually the default shell @code{sh}. The value
4982 returned is @var{cmd}'s exit status as returned by @code{waitpid}, which
4983 can be interpreted using the functions above.
4984
4985 If @code{system} is called without arguments, it returns a boolean
4986 indicating whether the command processor is available.
4987 @end deffn
4988
4989 \fgetenv
4990 @c snarfed from simpos.c:104
4991 @deffn primitive getenv nam
4992 Looks up the string @var{name} in the current environment. The return
4993 value is @code{#f} unless a string of the form @code{NAME=VALUE} is
4994 found, in which case the string @code{VALUE} is returned.
4995 @end deffn
4996
4997 \fprimitive-exit
4998 @c snarfed from simpos.c:120
4999 @deffn primitive primitive-exit [status]
5000 Terminate the current process without unwinding the Scheme stack.
5001 This is would typically be useful after a fork. The exit status
5002 is @var{status} if supplied, otherwise zero.
5003 @end deffn
5004
5005 \fhtons
5006 @c snarfed from socket.c:89
5007 @deffn primitive htons in
5008 Returns a new integer from @var{value} by converting from host to
5009 network order. @var{value} must be within the range of a C unsigned
5010 short integer.
5011 @end deffn
5012
5013 \fntohs
5014 @c snarfed from socket.c:106
5015 @deffn primitive ntohs in
5016 Returns a new integer from @var{value} by converting from network to
5017 host order. @var{value} must be within the range of a C unsigned short
5018 integer.
5019 @end deffn
5020
5021 \fhtonl
5022 @c snarfed from socket.c:123
5023 @deffn primitive htonl in
5024 Returns a new integer from @var{value} by converting from host to
5025 network order. @var{value} must be within the range of a C unsigned
5026 long integer.
5027 @end deffn
5028
5029 \fntohl
5030 @c snarfed from socket.c:135
5031 @deffn primitive ntohl in
5032 Returns a new integer from @var{value} by converting from network to
5033 host order. @var{value} must be within the range of a C unsigned
5034 long integer.
5035 @end deffn
5036
5037 \fsocket
5038 @c snarfed from socket.c:158
5039 @deffn primitive socket family style proto
5040 Returns a new socket port of the type specified by @var{family}, @var{style}
5041 and @var{protocol}. All three parameters are integers. Typical values
5042 for @var{family} are the values of @code{AF_UNIX}
5043 and @code{AF_INET}. Typical values for @var{style} are
5044 the values of @code{SOCK_STREAM}, @code{SOCK_DGRAM} and @code{SOCK_RAW}.
5045
5046 @var{protocol} can be obtained from a protocol name using
5047 @code{getprotobyname}. A value of
5048 zero specifies the default protocol, which is usually right.
5049
5050 A single socket port cannot by used for communication until
5051 it has been connected to another socket.
5052 @end deffn
5053
5054 \fsocketpair
5055 @c snarfed from socket.c:180
5056 @deffn primitive socketpair family style proto
5057 Returns a pair of connected (but unnamed) socket ports of the type specified
5058 by @var{family}, @var{style} and @var{protocol}.
5059 Many systems support only
5060 socket pairs of the @code{AF_UNIX} family. Zero is likely to be
5061 the only meaningful value for @var{protocol}.
5062 @end deffn
5063
5064 \fgetsockopt
5065 @c snarfed from socket.c:209
5066 @deffn primitive getsockopt sock level optname
5067 Returns the value of a particular socket option for the socket
5068 port @var{socket}. @var{level} is an integer code for type of option
5069 being requested, e.g., @code{SOL_SOCKET} for socket-level options.
5070 @var{optname} is an
5071 integer code for the option required and should be specified using one of
5072 the symbols @code{SO_DEBUG}, @code{SO_REUSEADDR} etc.
5073
5074 The returned value is typically an integer but @code{SO_LINGER} returns a
5075 pair of integers.
5076 @end deffn
5077
5078 \fsetsockopt
5079 @c snarfed from socket.c:277
5080 @deffn primitive setsockopt sock level optname value
5081 Sets the value of a particular socket option for the socket
5082 port @var{socket}. @var{level} is an integer code for type of option
5083 being set, e.g., @code{SOL_SOCKET} for socket-level options.
5084 @var{optname} is an
5085 integer code for the option to set and should be specified using one of
5086 the symbols @code{SO_DEBUG}, @code{SO_REUSEADDR} etc.
5087 @var{value} is the value to which the option should be set. For
5088 most options this must be an integer, but for @code{SO_LINGER} it must
5089 be a pair.
5090
5091 The return value is unspecified.
5092 @end deffn
5093
5094 \fshutdown
5095 @c snarfed from socket.c:381
5096 @deffn primitive shutdown sock how
5097 Sockets can be closed simply by using @code{close-port}. The
5098 @code{shutdown} procedure allows reception or tranmission on a
5099 connection to be shut down individually, according to the parameter
5100 @var{how}:
5101
5102 @table @asis
5103 @item 0
5104 Stop receiving data for this socket. If further data arrives, reject it.
5105 @item 1
5106 Stop trying to transmit data from this socket. Discard any
5107 data waiting to be sent. Stop looking for acknowledgement of
5108 data already sent; don't retransmit it if it is lost.
5109 @item 2
5110 Stop both reception and transmission.
5111 @end table
5112
5113 The return value is unspecified.
5114 @end deffn
5115
5116 \fconnect
5117 @c snarfed from socket.c:474
5118 @deffn primitive connect sock fam address . args
5119 Initiates a connection from @var{socket} to the address
5120 specified by @var{address} and possibly @var{arg @dots{}}. The format
5121 required for @var{address}
5122 and @var{arg} @dots{} depends on the family of the socket.
5123
5124 For a socket of family @code{AF_UNIX},
5125 only @code{address} is specified and must be a string with the
5126 filename where the socket is to be created.
5127
5128 For a socket of family @code{AF_INET},
5129 @code{address} must be an integer Internet host address and @var{arg} @dots{}
5130 must be a single integer port number.
5131
5132 The return value is unspecified.
5133 @end deffn
5134
5135 \fbind
5136 @c snarfed from socket.c:528
5137 @deffn primitive bind sock fam address . args
5138 Assigns an address to the socket port @var{socket}.
5139 Generally this only needs to be done for server sockets,
5140 so they know where to look for incoming connections. A socket
5141 without an address will be assigned one automatically when it
5142 starts communicating.
5143
5144 The format of @var{address} and @var{ARG} @dots{} depends on the family
5145 of the socket.
5146
5147 For a socket of family @code{AF_UNIX}, only @var{address}
5148 is specified and must
5149 be a string with the filename where the socket is to be created.
5150
5151 For a socket of family @code{AF_INET}, @var{address} must be an integer
5152 Internet host address and @var{arg} @dots{} must be a single integer
5153 port number.
5154
5155 The values of the following variables can also be used for @var{address}:
5156
5157 @defvar INADDR_ANY
5158 Allow connections from any address.
5159 @end defvar
5160
5161 @defvar INADDR_LOOPBACK
5162 The address of the local host using the loopback device.
5163 @end defvar
5164
5165 @defvar INADDR_BROADCAST
5166 The broadcast address on the local network.
5167 @end defvar
5168
5169 @defvar INADDR_NONE
5170 No address.
5171 @end defvar
5172
5173 The return value is unspecified.
5174 @end deffn
5175
5176 \flisten
5177 @c snarfed from socket.c:561
5178 @deffn primitive listen sock backlog
5179 This procedure enables @var{socket} to accept connection
5180 requests. @var{backlog} is an integer specifying
5181 the maximum length of the queue for pending connections.
5182 If the queue fills, new clients will fail to connect until the
5183 server calls @code{accept} to accept a connection from the queue.
5184
5185 The return value is unspecified.
5186 @end deffn
5187
5188 \faccept
5189 @c snarfed from socket.c:637
5190 @deffn primitive accept sock
5191 Accepts a connection on a bound, listening socket @var{socket}. If there
5192 are no pending connections in the queue, it waits until
5193 one is available unless the non-blocking option has been set on the
5194 socket.
5195
5196 The return value is a
5197 pair in which the CAR is a new socket port for the connection and
5198 the CDR is an object with address information about the client which
5199 initiated the connection.
5200
5201 If the address is not available then the CDR will be an empty vector.
5202
5203 @var{socket} does not become part of the
5204 connection and will continue to accept new requests.
5205 @end deffn
5206
5207 \fgetsockname
5208 @c snarfed from socket.c:668
5209 @deffn primitive getsockname sock
5210 Returns the address of @var{socket}, in the same form as the object
5211 returned by @code{accept}. On many systems the address of a socket
5212 in the @code{AF_FILE} namespace cannot be read.
5213 @end deffn
5214
5215 \fgetpeername
5216 @c snarfed from socket.c:695
5217 @deffn primitive getpeername sock
5218 Returns the address of the socket that the socket @var{socket} is connected to,
5219 in the same form as the object
5220 returned by @code{accept}. On many systems the address of a socket
5221 in the @code{AF_FILE} namespace cannot be read.
5222 @end deffn
5223
5224 \frecv!
5225 @c snarfed from socket.c:730
5226 @deffn primitive recv! sock buf [flags]
5227 Receives data from the socket port @var{socket}. @var{socket} must already
5228 be bound to the address from which data is to be received.
5229 @var{buf} is a string into which
5230 the data will be written. The size of @var{buf} limits the amount of
5231 data which can be received: in the case of packet
5232 protocols, if a packet larger than this limit is encountered then some data
5233 will be irrevocably lost.
5234
5235 The optional @var{flags} argument is a value or
5236 bitwise OR of MSG_OOB, MSG_PEEK, MSG_DONTROUTE etc.
5237
5238 The value returned is the number of bytes read from the socket.
5239
5240 Note that the data is read directly from the socket file descriptor:
5241 any unread buffered port data is ignored.
5242 @end deffn
5243
5244 \fsend
5245 @c snarfed from socket.c:759
5246 @deffn primitive send sock message [flags]
5247 Transmits the string @var{message} on the socket port @var{socket}.
5248 @var{socket} must already be bound to a destination address. The
5249 value returned is the number of bytes transmitted -- it's possible for
5250 this to be less than the length of @var{message} if the socket is
5251 set to be non-blocking. The optional @var{flags} argument is a value or
5252 bitwise OR of MSG_OOB, MSG_PEEK, MSG_DONTROUTE etc.
5253
5254 Note that the data is written directly to the socket file descriptor:
5255 any unflushed buffered port data is ignored.
5256 @end deffn
5257
5258 \frecvfrom!
5259 @c snarfed from socket.c:797
5260 @deffn primitive recvfrom! sock str [flags [start [end]]]
5261 Returns data from the socket port @var{socket} and also information about
5262 where the data was received from. @var{socket} must already
5263 be bound to the address from which data is to be received.
5264 @code{str}, is a string into which
5265 the data will be written. The size of @var{str} limits the amount of
5266 data which can be received: in the case of packet
5267 protocols, if a packet larger than this limit is encountered then some data
5268 will be irrevocably lost.
5269
5270 The optional @var{flags} argument is a value or
5271 bitwise OR of MSG_OOB, MSG_PEEK, MSG_DONTROUTE etc.
5272
5273 The value returned is a pair: the CAR is the number of bytes read from
5274 the socket and the CDR an address object in the same form as returned by
5275 @code{accept}.
5276
5277 The @var{start} and @var{end} arguments specify a substring of @var{str}
5278 to which the data should be written.
5279
5280 Note that the data is read directly from the socket file descriptor:
5281 any unread buffered port data is ignored.
5282 @end deffn
5283
5284 \fsendto
5285 @c snarfed from socket.c:848
5286 @deffn primitive sendto sock message fam address . args_and_flags
5287 Transmits the string @var{message} on the socket port @var{socket}. The
5288 destination address is specified using the @var{family}, @var{address} and
5289 @var{arg} arguments, in a similar way to the @code{connect}
5290 procedure. The
5291 value returned is the number of bytes transmitted -- it's possible for
5292 this to be less than the length of @var{message} if the socket is
5293 set to be non-blocking. The optional @var{flags} argument is a value or
5294 bitwise OR of MSG_OOB, MSG_PEEK, MSG_DONTROUTE etc.
5295
5296 Note that the data is written directly to the socket file descriptor:
5297 any unflushed buffered port data is ignored.
5298 @end deffn
5299
5300 \frestricted-vector-sort!
5301 @c snarfed from sort.c:425
5302 @deffn primitive restricted-vector-sort! vec less startpos endpos
5303 Sort the vector @var{vec}, using @var{less} for comparing
5304 the vector elements. @var{startpos} and @var{endpos} delimit
5305 the range of the vector which gets sorted. The return value
5306 is not specified.
5307 @end deffn
5308
5309 \fsorted?
5310 @c snarfed from sort.c:456
5311 @deffn primitive sorted? items less
5312 Return @code{#t} iff @var{items} is a list or a vector such that
5313 for all 1 <= i <= m, the predicate @var{less} returns true when
5314 applied to all elements i - 1 and i
5315 @end deffn
5316
5317 \fmerge
5318 @c snarfed from sort.c:528
5319 @deffn primitive merge alist blist less
5320 Takes two lists @var{alist} and @var{blist} such that
5321 @code{(sorted? alist less?)} and @code{(sorted? blist less?)} and
5322 returns a new list in which the elements of @var{alist} and
5323 @var{blist} have been stably interleaved so that
5324 @code{(sorted? (merge alist blist less?) less?)}.
5325 Note: this does _not_ accept vectors.
5326 @end deffn
5327
5328 \fmerge!
5329 @c snarfed from sort.c:641
5330 @deffn primitive merge! alist blist less
5331 Takes two lists @var{alist} and @var{blist} such that
5332 @code{(sorted? alist less?)} and @code{(sorted? blist less?)} and
5333 returns a new list in which the elements of @var{alist} and
5334 @var{blist} have been stably interleaved so that
5335 @code{(sorted? (merge alist blist less?) less?)}.
5336 This is the destructive variant of @code{merge}
5337 Note: this does _not_ accept vectors.
5338 @end deffn
5339
5340 \fsort!
5341 @c snarfed from sort.c:717
5342 @deffn primitive sort! items less
5343 Sort the sequence @var{items}, which may be a list or a
5344 vector. @var{less} is used for comparing the sequence
5345 elements. The sorting is destructive, that means that the
5346 input sequence is modified to produce the sorted result.
5347 This is not a stable sort.
5348 @end deffn
5349
5350 \fsort
5351 @c snarfed from sort.c:751
5352 @deffn primitive sort items less
5353 Sort the sequence @var{items}, which may be a list or a
5354 vector. @var{less} is used for comparing the sequence
5355 elements. This is not a stable sort.
5356 @end deffn
5357
5358 \fstable-sort!
5359 @c snarfed from sort.c:847
5360 @deffn primitive stable-sort! items less
5361 Sort the sequence @var{items}, which may be a list or a
5362 vector. @var{less} is used for comparing the sequence elements.
5363 The sorting is destructive, that means that the input sequence
5364 is modified to produce the sorted result.
5365 This is a stable sort.
5366 @end deffn
5367
5368 \fstable-sort
5369 @c snarfed from sort.c:887
5370 @deffn primitive stable-sort items less
5371 Sort the sequence @var{items}, which may be a list or a
5372 vector. @var{less} is used for comparing the sequence elements.
5373 This is a stable sort.
5374 @end deffn
5375
5376 \fsort-list!
5377 @c snarfed from sort.c:933
5378 @deffn primitive sort-list! items less
5379 Sort the list @var{items}, using @var{less} for comparing the
5380 list elements. The sorting is destructive, that means that the
5381 input list is modified to produce the sorted result.
5382 This is a stable sort.
5383 @end deffn
5384
5385 \fsort-list
5386 @c snarfed from sort.c:947
5387 @deffn primitive sort-list items less
5388 Sort the list @var{items}, using @var{less} for comparing the
5389 list elements. This is a stable sort.
5390 @end deffn
5391
5392 \fsource-properties
5393 @c snarfed from srcprop.c:171
5394 @deffn primitive source-properties obj
5395 Return the source property association list of @var{obj}.
5396 @end deffn
5397
5398 \fset-source-properties!
5399 @c snarfed from srcprop.c:194
5400 @deffn primitive set-source-properties! obj plist
5401 Install the association list @var{plist} as the source property
5402 list for @var{obj}.
5403 @end deffn
5404
5405 \fsource-property
5406 @c snarfed from srcprop.c:214
5407 @deffn primitive source-property obj key
5408 Return the source property specified by @var{key} from
5409 @var{obj}'s source property list.
5410 @end deffn
5411
5412 \fset-source-property!
5413 @c snarfed from srcprop.c:247
5414 @deffn primitive set-source-property! obj key datum
5415 Set the source property of object @var{obj}, which is specified by
5416 @var{key} to @var{datum}. Normally, the key will be a symbol.
5417 @end deffn
5418
5419 \fstack?
5420 @c snarfed from stacks.c:407
5421 @deffn primitive stack? obj
5422 Return @code{#t} if @var{obj} is a calling stack.
5423 @end deffn
5424
5425 \fmake-stack
5426 @c snarfed from stacks.c:421
5427 @deffn primitive make-stack obj . args
5428 Create a new stack. If @var{obj} is @code{#t}, the current
5429 evaluation stack is used for creating the stack frames,
5430 otherwise the frames are taken from @var{obj} (which must be
5431 either a debug object or a continuation).
5432 @var{args} must be a list if integers and specifies how the
5433 resulting stack will be narrowed.
5434 @end deffn
5435
5436 \fstack-id
5437 @c snarfed from stacks.c:512
5438 @deffn primitive stack-id stack
5439 Return the identifier given to @var{stack} by @code{start-stack}.
5440 @end deffn
5441
5442 \fstack-ref
5443 @c snarfed from stacks.c:548
5444 @deffn primitive stack-ref stack i
5445 Return the @var{i}'th frame from @var{stack}.
5446 @end deffn
5447
5448 \fstack-length
5449 @c snarfed from stacks.c:562
5450 @deffn primitive stack-length stack
5451 Return the length of @var{stack}.
5452 @end deffn
5453
5454 \fframe?
5455 @c snarfed from stacks.c:575
5456 @deffn primitive frame? obj
5457 Return @code{#t} if @var{obj} is a stack frame.
5458 @end deffn
5459
5460 \flast-stack-frame
5461 @c snarfed from stacks.c:586
5462 @deffn primitive last-stack-frame obj
5463 Return a stack which consists of a single frame, which is the
5464 last stack frame for @var{obj}. @var{obj} must be either a
5465 debug object or a continuation.
5466 @end deffn
5467
5468 \fframe-number
5469 @c snarfed from stacks.c:627
5470 @deffn primitive frame-number frame
5471 Return the frame number of @var{frame}.
5472 @end deffn
5473
5474 \fframe-source
5475 @c snarfed from stacks.c:637
5476 @deffn primitive frame-source frame
5477 Return the source of @var{frame}.
5478 @end deffn
5479
5480 \fframe-procedure
5481 @c snarfed from stacks.c:648
5482 @deffn primitive frame-procedure frame
5483 Return the procedure for @var{frame}, or @code{#f} if no
5484 procedure is associated with @var{frame}.
5485 @end deffn
5486
5487 \fframe-arguments
5488 @c snarfed from stacks.c:660
5489 @deffn primitive frame-arguments frame
5490 Return the arguments of @var{frame}.
5491 @end deffn
5492
5493 \fframe-previous
5494 @c snarfed from stacks.c:671
5495 @deffn primitive frame-previous frame
5496 Return the previous frame of @var{frame}, or @code{#f} if
5497 @var{frame} is the first frame in its stack.
5498 @end deffn
5499
5500 \fframe-next
5501 @c snarfed from stacks.c:687
5502 @deffn primitive frame-next frame
5503 Return the next frame of @var{frame}, or @code{#f} if
5504 @var{frame} is the last frame in its stack.
5505 @end deffn
5506
5507 \fframe-real?
5508 @c snarfed from stacks.c:702
5509 @deffn primitive frame-real? frame
5510 Return @code{#t} if @var{frame} is a real frame.
5511 @end deffn
5512
5513 \fframe-procedure?
5514 @c snarfed from stacks.c:712
5515 @deffn primitive frame-procedure? frame
5516 Return @code{#t} if a procedure is associated with @var{frame}.
5517 @end deffn
5518
5519 \fframe-evaluating-args?
5520 @c snarfed from stacks.c:722
5521 @deffn primitive frame-evaluating-args? frame
5522 Return @code{#t} if @var{frame} contains evaluated arguments.
5523 @end deffn
5524
5525 \fframe-overflow?
5526 @c snarfed from stacks.c:732
5527 @deffn primitive frame-overflow? frame
5528 Return @code{#t} if @var{frame} is an overflow frame.
5529 @end deffn
5530
5531 \fget-internal-real-time
5532 @c snarfed from stime.c:141
5533 @deffn primitive get-internal-real-time
5534 Returns the number of time units since the interpreter was started.
5535 @end deffn
5536
5537 \ftimes
5538 @c snarfed from stime.c:183
5539 @deffn primitive times
5540 Returns an object with information about real and processor time.
5541 The following procedures accept such an object as an argument and
5542 return a selected component:
5543
5544 @table @code
5545 @item tms:clock
5546 The current real time, expressed as time units relative to an
5547 arbitrary base.
5548 @item tms:utime
5549 The CPU time units used by the calling process.
5550 @item tms:stime
5551 The CPU time units used by the system on behalf of the calling process.
5552 @item tms:cutime
5553 The CPU time units used by terminated child processes of the calling
5554 process, whose status has been collected (e.g., using @code{waitpid}).
5555 @item tms:cstime
5556 Similarly, the CPU times units used by the system on behalf of
5557 terminated child processes.
5558 @end table
5559 @end deffn
5560
5561 \fget-internal-run-time
5562 @c snarfed from stime.c:214
5563 @deffn primitive get-internal-run-time
5564 Returns the number of time units of processor time used by the interpreter.
5565 Both "system" and "user" time are included but subprocesses are not.
5566 @end deffn
5567
5568 \fcurrent-time
5569 @c snarfed from stime.c:224
5570 @deffn primitive current-time
5571 Returns the number of seconds since 1970-01-01 00:00:00 UTC, excluding
5572 leap seconds.
5573 @end deffn
5574
5575 \fgettimeofday
5576 @c snarfed from stime.c:241
5577 @deffn primitive gettimeofday
5578 Returns a pair containing the number of seconds and microseconds since
5579 1970-01-01 00:00:00 UTC, excluding leap seconds. Note: whether true
5580 microsecond resolution is available depends on the operating system.
5581 @end deffn
5582
5583 \flocaltime
5584 @c snarfed from stime.c:341
5585 @deffn primitive localtime time [zone]
5586 Returns an object representing the broken down components of @var{time},
5587 an integer like the one returned by @code{current-time}. The time zone
5588 for the calculation is optionally specified by @var{zone} (a string),
5589 otherwise the @code{TZ} environment variable or the system default is
5590 used.
5591 @end deffn
5592
5593 \fgmtime
5594 @c snarfed from stime.c:413
5595 @deffn primitive gmtime time
5596 Returns an object representing the broken down components of @var{time},
5597 an integer like the one returned by @code{current-time}. The values
5598 are calculated for UTC.
5599 @end deffn
5600
5601 \fmktime
5602 @c snarfed from stime.c:475
5603 @deffn primitive mktime sbd_time [zone]
5604 @var{bd-time} is an object representing broken down time and @code{zone}
5605 is an optional time zone specifier (otherwise the TZ environment variable
5606 or the system default is used).
5607
5608 Returns a pair: the car is a corresponding
5609 integer time value like that returned
5610 by @code{current-time}; the cdr is a broken down time object, similar to
5611 as @var{bd-time} but with normalized values.
5612 @end deffn
5613
5614 \ftzset
5615 @c snarfed from stime.c:548
5616 @deffn primitive tzset
5617 Initialize the timezone from the TZ environment variable
5618 or the system default. It's not usually necessary to call this procedure
5619 since it's done automatically by other procedures that depend on the
5620 timezone.
5621 @end deffn
5622
5623 \fstrftime
5624 @c snarfed from stime.c:565
5625 @deffn primitive strftime format stime
5626 Formats a time specification @var{time} using @var{template}. @var{time}
5627 is an object with time components in the form returned by @code{localtime}
5628 or @code{gmtime}. @var{template} is a string which can include formatting
5629 specifications introduced by a @code{%} character. The formatting of
5630 month and day names is dependent on the current locale. The value returned
5631 is the formatted string.
5632 @xref{Formatting Date and Time, , , libc, The GNU C Library Reference Manual}.)
5633 @end deffn
5634
5635 \fstrptime
5636 @c snarfed from stime.c:663
5637 @deffn primitive strptime format string
5638 Performs the reverse action to @code{strftime}, parsing
5639 @var{string} according to the specification supplied in
5640 @var{template}. The interpretation of month and day names is
5641 dependent on the current locale. The value returned is a pair.
5642 The car has an object with time components
5643 in the form returned by @code{localtime} or @code{gmtime},
5644 but the time zone components
5645 are not usefully set.
5646 The cdr reports the number of characters from @var{string}
5647 which were used for the conversion.
5648 @end deffn
5649
5650 \fstring?
5651 @c snarfed from strings.c:62
5652 @deffn primitive string? obj
5653 Returns @code{#t} iff @var{obj} is a string, else returns
5654 @code{#f}.
5655 @end deffn
5656
5657 \fread-only-string?
5658 @c snarfed from strings.c:85
5659 @deffn primitive read-only-string? obj
5660 Return true if @var{obj} can be read as a string,
5661
5662 This illustrates the difference between @code{string?} and
5663 @code{read-only-string?}:
5664
5665 @example
5666 (string? "a string") @result{} #t
5667 (string? 'a-symbol) @result{} #f
5668
5669 (read-only-string? "a string") @result{} #t
5670 (read-only-string? 'a-symbol) @result{} #t
5671 @end example
5672 @end deffn
5673
5674 \flist->string
5675 @c snarfed from strings.c:94
5676 @deffn primitive list->string
5677 scm_string
5678 @end deffn
5679
5680 \fstring
5681 @c snarfed from strings.c:100
5682 @deffn primitive string . chrs
5683 @deffnx primitive list->string chrs
5684 Returns a newly allocated string composed of the arguments,
5685 @var{chrs}.
5686 @end deffn
5687
5688 \fmake-string
5689 @c snarfed from strings.c:253
5690 @deffn primitive make-string k [chr]
5691 Return a newly allocated string of
5692 length @var{k}. If @var{chr} is given, then all elements of
5693 the string are initialized to @var{chr}, otherwise the contents
5694 of the @var{string} are unspecified.
5695 @end deffn
5696
5697 \fstring-length
5698 @c snarfed from strings.c:286
5699 @deffn primitive string-length string
5700 Return the number of characters in @var{string}.
5701 @end deffn
5702
5703 \fstring-ref
5704 @c snarfed from strings.c:297
5705 @deffn primitive string-ref str k
5706 Return character @var{k} of @var{str} using zero-origin
5707 indexing. @var{k} must be a valid index of @var{str}.
5708 @end deffn
5709
5710 \fstring-set!
5711 @c snarfed from strings.c:314
5712 @deffn primitive string-set! str k chr
5713 Store @var{chr} in element @var{k} of @var{str} and return
5714 an unspecified value. @var{k} must be a valid index of
5715 @var{str}.
5716 @end deffn
5717
5718 \fsubstring
5719 @c snarfed from strings.c:337
5720 @deffn primitive substring str start [end]
5721 Return a newly allocated string formed from the characters
5722 of @var{str} beginning with index @var{start} (inclusive) and
5723 ending with index @var{end} (exclusive).
5724 @var{str} must be a string, @var{start} and @var{end} must be
5725 exact integers satisfying:
5726
5727 0 <= @var{start} <= @var{end} <= (string-length @var{str}).
5728 @end deffn
5729
5730 \fstring-append
5731 @c snarfed from strings.c:360
5732 @deffn primitive string-append . args
5733 Return a newly allocated string whose characters form the
5734 concatenation of the given strings, @var{args}.
5735 @end deffn
5736
5737 \fmake-shared-substring
5738 @c snarfed from strings.c:400
5739 @deffn primitive make-shared-substring str [frm [to]]
5740 Return a shared substring of @var{str}. The semantics are the same as
5741 for the @code{substring} function: the shared substring returned
5742 includes all of the text from @var{str} between indexes @var{start}
5743 (inclusive) and @var{end} (exclusive). If @var{end} is omitted, it
5744 defaults to the end of @var{str}. The shared substring returned by
5745 @code{make-shared-substring} occupies the same storage space as
5746 @var{str}.
5747 @end deffn
5748
5749 \fstring-index
5750 @c snarfed from strop.c:121
5751 @deffn primitive string-index str chr [frm [to]]
5752 Return the index of the first occurrence of @var{chr} in
5753 @var{str}. The optional integer arguments @var{frm} and
5754 @var{to} limit the search to a portion of the string. This
5755 procedure essentially implements the @code{index} or
5756 @code{strchr} functions from the C library.
5757
5758 (qdocs:) Returns
5759 the index of @var{char} in @var{str}, or @code{#f} if the
5760 @var{char} isn't in @var{str}. If @var{frm} is given and not
5761 @code{#f}, it is used as the starting index; if @var{to} is
5762 given and not @code{#f}, it is used as the ending index
5763 (exclusive).
5764
5765 @example
5766 (string-index "weiner" #\e)
5767 @result{} 1
5768
5769 (string-index "weiner" #\e 2)
5770 @result{} 4
5771
5772 (string-index "weiner" #\e 2 4)
5773 @result{} #f
5774 @end example
5775 @end deffn
5776
5777 \fstring-rindex
5778 @c snarfed from strop.c:152
5779 @deffn primitive string-rindex str chr [frm [to]]
5780 Like @code{string-index}, but search from the right of the string rather
5781 than from the left. This procedure essentially implements the
5782 @code{rindex} or @code{strrchr} functions from the C library.
5783
5784 (qdocs:) The same as @code{string-index}, except it gives the rightmost occurance
5785 of @var{char} in the range [@var{frm}, @var{to}-1], which defaults to
5786 the entire string.
5787
5788 @example
5789 (string-rindex "weiner" #\e)
5790 @result{} 4
5791
5792 (string-rindex "weiner" #\e 2 4)
5793 @result{} #f
5794
5795 (string-rindex "weiner" #\e 2 5)
5796 @result{} 4
5797 @end example
5798 @end deffn
5799
5800 \fsubstring-move-left!
5801 @c snarfed from strop.c:169
5802 @deffn primitive substring-move-left!
5803 scm_substring_move_x
5804 @end deffn
5805
5806 \fsubstring-move-right!
5807 @c snarfed from strop.c:170
5808 @deffn primitive substring-move-right!
5809 scm_substring_move_x
5810 @end deffn
5811
5812 \fsubstring-move!
5813 @c snarfed from strop.c:244
5814 @deffn primitive substring-move! str1 start1 end1 str2 start2
5815 @deffnx primitive substring-move-left! str1 start1 end1 str2 start2
5816 @deffnx primitive substring-move-right! str1 start1 end1 str2 start2
5817 Copy the substring of @var{str1} bounded by @var{start1} and @var{end1}
5818 into @var{str2} beginning at position @var{end2}.
5819 @code{substring-move-right!} begins copying from the rightmost character
5820 and moves left, and @code{substring-move-left!} copies from the leftmost
5821 character moving right.
5822
5823 It is useful to have two functions that copy in different directions so
5824 that substrings can be copied back and forth within a single string. If
5825 you wish to copy text from the left-hand side of a string to the
5826 right-hand side of the same string, and the source and destination
5827 overlap, you must be careful to copy the rightmost characters of the
5828 text first, to avoid clobbering your data. Hence, when @var{str1} and
5829 @var{str2} are the same string, you should use
5830 @code{substring-move-right!} when moving text from left to right, and
5831 @code{substring-move-left!} otherwise. If @code{str1} and @samp{str2}
5832 are different strings, it does not matter which function you use.
5833 @end deffn
5834
5835 \fsubstring-fill!
5836 @c snarfed from strop.c:280
5837 @deffn primitive substring-fill! str start end fill
5838 Change every character in @var{str} between @var{start} and @var{end} to
5839 @var{fill-char}.
5840
5841 (qdocs:) Destructively fills @var{str}, from @var{start} to @var{end}, with @var{fill}.
5842
5843 @example
5844 (define y "abcdefg")
5845 (substring-fill! y 1 3 #\r)
5846 y
5847 @result{} "arrdefg"
5848 @end example
5849 @end deffn
5850
5851 \fstring-null?
5852 @c snarfed from strop.c:307
5853 @deffn primitive string-null? str
5854 Return @code{#t} if @var{str}'s length is nonzero, and @code{#f}
5855 otherwise.
5856
5857 (qdocs:) Returns @code{#t} if @var{str} is empty, else returns @code{#f}.
5858
5859 @example
5860 (string-null? "")
5861 @result{} #t
5862
5863 (string-null? y)
5864 @result{} #f
5865 @end example
5866 @end deffn
5867
5868 \fstring->list
5869 @c snarfed from strop.c:323
5870 @deffn primitive string->list str
5871 @samp{String->list} returns a newly allocated list of the
5872 characters that make up the given string. @samp{List->string}
5873 returns a newly allocated string formed from the characters in the list
5874 @var{list}, which must be a list of characters. @samp{String->list}
5875 and @samp{list->string} are
5876 inverses so far as @samp{equal?} is concerned. (r5rs)
5877 @end deffn
5878
5879 \fstring-copy
5880 @c snarfed from strop.c:348
5881 @deffn primitive string-copy str
5882 Returns a newly allocated copy of the given @var{string}. (r5rs)
5883 @end deffn
5884
5885 \fstring-fill!
5886 @c snarfed from strop.c:361
5887 @deffn primitive string-fill! str chr
5888 Stores @var{char} in every element of the given @var{string} and returns an
5889 unspecified value. (r5rs)
5890 @end deffn
5891
5892 \fstring-upcase!
5893 @c snarfed from strop.c:397
5894 @deffn primitive string-upcase! str
5895 Destructively upcase every character in @code{str}.
5896
5897 (qdocs:) Converts each element in @var{str} to upper case.
5898
5899 @example
5900 (string-upcase! y)
5901 @result{} "ARRDEFG"
5902
5903 y
5904 @result{} "ARRDEFG"
5905 @end example
5906 @end deffn
5907
5908 \fstring-upcase
5909 @c snarfed from strop.c:409
5910 @deffn primitive string-upcase str
5911 Upcase every character in @code{str}.
5912 @end deffn
5913
5914 \fstring-downcase!
5915 @c snarfed from strop.c:444
5916 @deffn primitive string-downcase! str
5917 Destructively downcase every character in @code{str}.
5918
5919 (qdocs:) Converts each element in @var{str} to lower case.
5920
5921 @example
5922 y
5923 @result{} "ARRDEFG"
5924
5925 (string-downcase! y)
5926 @result{} "arrdefg"
5927
5928 y
5929 @result{} "arrdefg"
5930 @end example
5931 @end deffn
5932
5933 \fstring-downcase
5934 @c snarfed from strop.c:456
5935 @deffn primitive string-downcase str
5936 Downcase every character in @code{str}.
5937 @end deffn
5938
5939 \fstring-capitalize!
5940 @c snarfed from strop.c:493
5941 @deffn primitive string-capitalize! str
5942 Destructively capitalize every character in @code{str}.
5943 @end deffn
5944
5945 \fstring-capitalize
5946 @c snarfed from strop.c:505
5947 @deffn primitive string-capitalize str
5948 Capitalize every character in @code{str}.
5949 @end deffn
5950
5951 \fstring-ci->symbol
5952 @c snarfed from strop.c:517
5953 @deffn primitive string-ci->symbol str
5954 Return the symbol whose name is @var{str}, downcased in necessary(???).
5955 @end deffn
5956
5957 \fstring=?
5958 @c snarfed from strorder.c:64
5959 @deffn primitive string=? s1 s2
5960 Lexicographic equality predicate;
5961 Returns @code{#t} if the two strings are the same length and
5962 contain the same characters in the same positions, otherwise
5963 returns @code{#f}. (r5rs)
5964
5965 The procedure @code{string-ci=?} treats upper and lower case
5966 letters as though they were the same character, but
5967 @code{string=?} treats upper and lower case as distinct
5968 characters.
5969 @end deffn
5970
5971 \fstring-ci=?
5972 @c snarfed from strorder.c:99
5973 @deffn primitive string-ci=? s1 s2
5974 Case-insensitive string equality predicate; returns @code{#t}
5975 if the two strings are the same length and their component
5976 characters match (ignoring case) at each position; otherwise
5977 returns @code{#f}. (r5rs)
5978 @end deffn
5979
5980 \fstring<?
5981 @c snarfed from strorder.c:156
5982 @deffn primitive string<? s1 s2
5983 Lexicographic ordering predicate; returns @code{#t} if
5984 @var{s1} is lexicographically less than @var{s2}. (r5rs)
5985 @end deffn
5986
5987 \fstring<=?
5988 @c snarfed from strorder.c:171
5989 @deffn primitive string<=? s1 s2
5990 Lexicographic ordering predicate; returns @code{#t} if
5991 @var{s1} is lexicographically less than or equal to @var{s2}.
5992 (r5rs)
5993 @end deffn
5994
5995 \fstring>?
5996 @c snarfed from strorder.c:185
5997 @deffn primitive string>? s1 s2
5998 Lexicographic ordering predicate; returns @code{#t} if
5999 @var{s1} is lexicographically greater than @var{s2}. (r5rs)
6000 @end deffn
6001
6002 \fstring>=?
6003 @c snarfed from strorder.c:200
6004 @deffn primitive string>=? s1 s2
6005 Lexicographic ordering predicate; returns @code{#t} if
6006 @var{s1} is lexicographically greater than or equal to
6007 @var{s2}. (r5rs)
6008 @end deffn
6009
6010 \fstring-ci<?
6011 @c snarfed from strorder.c:239
6012 @deffn primitive string-ci<? s1 s2
6013 Case insensitive lexicographic ordering predicate;
6014 returns @code{#t} if @var{s1} is lexicographically less than
6015 @var{s2} regardless of case. (r5rs)
6016 @end deffn
6017
6018 \fstring-ci<=?
6019 @c snarfed from strorder.c:254
6020 @deffn primitive string-ci<=? s1 s2
6021 Case insensitive lexicographic ordering predicate;
6022 returns @code{#t} if @var{s1} is lexicographically less than
6023 or equal to @var{s2} regardless of case. (r5rs)
6024 @end deffn
6025
6026 \fstring-ci>?
6027 @c snarfed from strorder.c:269
6028 @deffn primitive string-ci>? s1 s2
6029 Case insensitive lexicographic ordering predicate;
6030 returns @code{#t} if @var{s1} is lexicographically greater
6031 than @var{s2} regardless of case. (r5rs)
6032 @end deffn
6033
6034 \fstring-ci>=?
6035 @c snarfed from strorder.c:284
6036 @deffn primitive string-ci>=? s1 s2
6037 Case insensitive lexicographic ordering predicate;
6038 returns @code{#t} if @var{s1} is lexicographically greater
6039 than or equal to @var{s2} regardless of case. (r5rs)
6040 @end deffn
6041
6042 \fobject->string
6043 @c snarfed from strports.c:318
6044 @deffn primitive object->string obj [printer]
6045 Return a Scheme string obtained by printing @var{obj}.
6046 Printing function can be specified by the optional second
6047 argument @var{printer} (default: @code{write}).
6048 @end deffn
6049
6050 \fcall-with-output-string
6051 @c snarfed from strports.c:352
6052 @deffn primitive call-with-output-string proc
6053 Calls the one-argument procedure @var{proc} with a newly created output
6054 port. When the function returns, the string composed of the characters
6055 written into the port is returned.
6056 @end deffn
6057
6058 \fcall-with-input-string
6059 @c snarfed from strports.c:371
6060 @deffn primitive call-with-input-string str proc
6061 Calls the one-argument procedure @var{proc} with a newly created input
6062 port from which @var{string}'s contents may be read. The value yielded
6063 by the @var{proc} is returned.
6064 @end deffn
6065
6066 \fopen-input-string
6067 @c snarfed from strports.c:384
6068 @deffn primitive open-input-string str
6069 Takes a string and returns an input port that delivers
6070 characters from the string. The port can be closed by
6071 @code{close-input-port}, though its storage will be reclaimed
6072 by the garbage collector if it becomes inaccessible.
6073 @end deffn
6074
6075 \fopen-output-string
6076 @c snarfed from strports.c:398
6077 @deffn primitive open-output-string
6078 Returns an output port that will accumulate characters for
6079 retrieval by @code{get-output-string}. The port can be closed
6080 by the procedure @code{close-output-port}, though its storage
6081 will be reclaimed by the garbage collector if it becomes
6082 inaccessible.
6083 @end deffn
6084
6085 \fget-output-string
6086 @c snarfed from strports.c:415
6087 @deffn primitive get-output-string port
6088 Given an output port created by @code{open-output-string},
6089 returns a string consisting of the characters that have been
6090 output to the port so far.
6091 @end deffn
6092
6093 \feval-string
6094 @c snarfed from strports.c:456
6095 @deffn primitive eval-string string
6096 Evaluate @var{string} as the text representation of a Scheme
6097 form or forms, and return whatever value they produce.
6098 Evaluation takes place in the environment returned by the
6099 procedure @code{interaction-environment}.
6100 @end deffn
6101
6102 \fmake-struct-layout
6103 @c snarfed from struct.c:79
6104 @deffn primitive make-struct-layout fields
6105 Return a new structure layout object.
6106
6107 @var{fields} must be a string made up of pairs of characters
6108 strung together. The first character of each pair describes a field
6109 type, the second a field protection. Allowed types are 'p' for
6110 GC-protected Scheme data, 'u' for unprotected binary data, and 's' for
6111 a field that points to the structure itself. Allowed protections
6112 are 'w' for mutable fields, 'r' for read-only fields, and 'o' for opaque
6113 fields. The last field protection specification may be capitalized to
6114 indicate that the field is a tail-array.
6115 @end deffn
6116
6117 \fstruct?
6118 @c snarfed from struct.c:246
6119 @deffn primitive struct? x
6120 Return @code{#t} iff @var{obj} is a structure object, else
6121 @code{#f}.
6122 @end deffn
6123
6124 \fstruct-vtable?
6125 @c snarfed from struct.c:255
6126 @deffn primitive struct-vtable? x
6127 Return @code{#t} iff obj is a vtable structure.
6128 @end deffn
6129
6130 \fmake-struct
6131 @c snarfed from struct.c:437
6132 @deffn primitive make-struct vtable tail_array_size . init
6133 Create a new structure.
6134
6135 @var{type} must be a vtable structure (@pxref{Vtables}).
6136
6137 @var{tail-elts} must be a non-negative integer. If the layout
6138 specification indicated by @var{type} includes a tail-array,
6139 this is the number of elements allocated to that array.
6140
6141 The @var{init1}, @dots{} are optional arguments describing how
6142 successive fields of the structure should be initialized. Only fields
6143 with protection 'r' or 'w' can be initialized, except for fields of
6144 type 's', which are automatically initialized to point to the new
6145 structure itself; fields with protection 'o' can not be initialized by
6146 Scheme programs.
6147
6148 If fewer optional arguments than initializable fields are supplied,
6149 fields of type 'p' get default value #f while fields of type 'u' are
6150 initialized to 0.
6151
6152 Structs are currently the basic representation for record-like data
6153 structures in Guile. The plan is to eventually replace them with a
6154 new representation which will at the same time be easier to use and
6155 more powerful.
6156
6157 For more information, see the documentation for @code{make-vtable-vtable}.
6158 @end deffn
6159
6160 \fmake-vtable-vtable
6161 @c snarfed from struct.c:523
6162 @deffn primitive make-vtable-vtable user_fields tail_array_size . init
6163 Return a new, self-describing vtable structure.
6164
6165 @var{user-fields} is a string describing user defined fields of the
6166 vtable beginning at index @code{vtable-offset-user}
6167 (see @code{make-struct-layout}).
6168
6169 @var{tail-size} specifies the size of the tail-array (if any) of
6170 this vtable.
6171
6172 @var{init1}, @dots{} are the optional initializers for the fields of
6173 the vtable.
6174
6175 Vtables have one initializable system field---the struct printer.
6176 This field comes before the user fields in the initializers passed
6177 to @code{make-vtable-vtable} and @code{make-struct}, and thus works as
6178 a third optional argument to @code{make-vtable-vtable} and a fourth to
6179 @code{make-struct} when creating vtables:
6180
6181 If the value is a procedure, it will be called instead of the standard
6182 printer whenever a struct described by this vtable is printed.
6183 The procedure will be called with arguments STRUCT and PORT.
6184
6185 The structure of a struct is described by a vtable, so the vtable is
6186 in essence the type of the struct. The vtable is itself a struct with
6187 a vtable. This could go on forever if it weren't for the
6188 vtable-vtables which are self-describing vtables, and thus terminate
6189 the chain.
6190
6191 There are several potential ways of using structs, but the standard
6192 one is to use three kinds of structs, together building up a type
6193 sub-system: one vtable-vtable working as the root and one or several
6194 "types", each with a set of "instances". (The vtable-vtable should be
6195 compared to the class <class> which is the class of itself.)
6196
6197 @example
6198 (define ball-root (make-vtable-vtable "pr" 0))
6199
6200 (define (make-ball-type ball-color)
6201 (make-struct ball-root 0
6202 (make-struct-layout "pw")
6203 (lambda (ball port)
6204 (format port "#<a ~A ball owned by ~A>"
6205 (color ball)
6206 (owner ball)))
6207 ball-color))
6208 (define (color ball) (struct-ref (struct-vtable ball) vtable-offset-user))
6209 (define (owner ball) (struct-ref ball 0))
6210
6211 (define red (make-ball-type 'red))
6212 (define green (make-ball-type 'green))
6213
6214 (define (make-ball type owner) (make-struct type 0 owner))
6215
6216 (define ball (make-ball green 'Nisse))
6217 ball @result{} #<a green ball owned by Nisse>
6218 @end example
6219 @end deffn
6220
6221 \fstruct-ref
6222 @c snarfed from struct.c:565
6223 @deffn primitive struct-ref handle pos
6224 @deffnx primitive struct-set! struct n value
6225 Access (or modify) the @var{n}th field of @var{struct}.
6226
6227 If the field is of type 'p', then it can be set to an arbitrary value.
6228
6229 If the field is of type 'u', then it can only be set to a non-negative
6230 integer value small enough to fit in one machine word.
6231 @end deffn
6232
6233 \fstruct-set!
6234 @c snarfed from struct.c:643
6235 @deffn primitive struct-set! handle pos val
6236 Set the slot of the structure @var{handle} with index @var{pos}
6237 to @var{val}. Signal an error if the slot can not be written
6238 to.
6239 @end deffn
6240
6241 \fstruct-vtable
6242 @c snarfed from struct.c:713
6243 @deffn primitive struct-vtable handle
6244 Return the vtable structure that describes the type of @var{struct}.
6245 @end deffn
6246
6247 \fstruct-vtable-tag
6248 @c snarfed from struct.c:724
6249 @deffn primitive struct-vtable-tag handle
6250 Return the vtable tag of the structure @var{handle}.
6251 @end deffn
6252
6253 \fstruct-vtable-name
6254 @c snarfed from struct.c:763
6255 @deffn primitive struct-vtable-name vtable
6256 Return the name of the vtable @var{vtable}.
6257 @end deffn
6258
6259 \fset-struct-vtable-name!
6260 @c snarfed from struct.c:773
6261 @deffn primitive set-struct-vtable-name! vtable name
6262 Set the name of the vtable @var{vtable} to @var{name}.
6263 @end deffn
6264
6265 \fsymbol?
6266 @c snarfed from symbols.c:422
6267 @deffn primitive symbol? obj
6268 Returns @code{#t} if @var{obj} is a symbol, otherwise returns
6269 @code{#f}. (r5rs)
6270 @end deffn
6271
6272 \fsymbol->string
6273 @c snarfed from symbols.c:451
6274 @deffn primitive symbol->string s
6275 Returns the name of @var{symbol} as a string. If the symbol
6276 was part of an object returned as the value of a literal
6277 expression (section @pxref{Literal expressions,,,r4rs, The
6278 Revised^4 Report on Scheme}) or by a call to the @code{read}
6279 procedure, and its name contains alphabetic characters, then
6280 the string returned will contain characters in the
6281 implementation's preferred standard case---some implementations
6282 will prefer upper case, others lower case. If the symbol was
6283 returned by @code{string->symbol}, the case of characters in
6284 the string returned will be the same as the case in the string
6285 that was passed to @code{string->symbol}. It is an error to
6286 apply mutation procedures like @code{string-set!} to strings
6287 returned by this procedure. (r5rs)
6288
6289 The following examples assume that the implementation's
6290 standard case is lower case:
6291
6292 @lisp
6293 (symbol->string 'flying-fish) @result{} "flying-fish"
6294 (symbol->string 'Martin) @result{} "martin"
6295 (symbol->string
6296 (string->symbol "Malvina")) @result{} "Malvina"
6297 @end lisp
6298 @end deffn
6299
6300 \fstring->symbol
6301 @c snarfed from symbols.c:478
6302 @deffn primitive string->symbol s
6303 Returns the symbol whose name is @var{string}. This procedure
6304 can create symbols with names containing special characters or
6305 letters in the non-standard case, but it is usually a bad idea
6306 to create such because in some implementations of Scheme they
6307 cannot be read as themselves. See @code{symbol->string}.
6308
6309 The following examples assume that the implementation's
6310 standard case is lower case:
6311
6312 @lisp
6313 (eq? 'mISSISSIppi 'mississippi) @result{} #t
6314 (string->symbol "mISSISSIppi") @result{} @r{the symbol with name "mISSISSIppi"}
6315 (eq? 'bitBlt (string->symbol "bitBlt")) @result{} #f
6316 (eq? 'JollyWog
6317 (string->symbol (symbol->string 'JollyWog))) @result{} #t
6318 (string=? "K. Harper, M.D."
6319 (symbol->string
6320 (string->symbol "K. Harper, M.D."))) @result{}#t
6321 @end lisp
6322 @end deffn
6323
6324 \fstring->obarray-symbol
6325 @c snarfed from symbols.c:499
6326 @deffn primitive string->obarray-symbol o s [softp]
6327 Intern a new symbol in @var{obarray}, a symbol table, with name
6328 @var{string}.
6329
6330 If @var{obarray} is @code{#f}, use the default system symbol table. If
6331 @var{obarray} is @code{#t}, the symbol should not be interned in any
6332 symbol table; merely return the pair (@var{symbol}
6333 . @var{#<undefined>}).
6334
6335 The @var{soft?} argument determines whether new symbol table entries
6336 should be created when the specified symbol is not already present in
6337 @var{obarray}. If @var{soft?} is specified and is a true value, then
6338 new entries should not be added for symbols not already present in the
6339 table; instead, simply return @code{#f}.
6340 @end deffn
6341
6342 \fintern-symbol
6343 @c snarfed from symbols.c:531
6344 @deffn primitive intern-symbol o s
6345 Add a new symbol to @var{obarray} with name @var{string}, bound to an
6346 unspecified initial value. The symbol table is not modified if a symbol
6347 with this name is already present.
6348 @end deffn
6349
6350 \funintern-symbol
6351 @c snarfed from symbols.c:568
6352 @deffn primitive unintern-symbol o s
6353 Remove the symbol with name @var{string} from @var{obarray}. This
6354 function returns @code{#t} if the symbol was present and @code{#f}
6355 otherwise.
6356 @end deffn
6357
6358 \fsymbol-binding
6359 @c snarfed from symbols.c:609
6360 @deffn primitive symbol-binding o s
6361 Look up in @var{obarray} the symbol whose name is @var{string}, and
6362 return the value to which it is bound. If @var{obarray} is @code{#f},
6363 use the global symbol table. If @var{string} is not interned in
6364 @var{obarray}, an error is signalled.
6365 @end deffn
6366
6367 \fsymbol-interned?
6368 @c snarfed from symbols.c:626
6369 @deffn primitive symbol-interned? o s
6370 Return @code{#t} if @var{obarray} contains a symbol with name
6371 @var{string}, and @code{#f} otherwise.
6372 @end deffn
6373
6374 \fsymbol-bound?
6375 @c snarfed from symbols.c:649
6376 @deffn primitive symbol-bound? o s
6377 Return @code{#t} if @var{obarray} contains a symbol with name
6378 @var{string} bound to a defined value. This differs from
6379 @var{symbol-interned?} in that the mere mention of a symbol
6380 usually causes it to be interned; @code{symbol-bound?}
6381 determines whether a symbol has been given any meaningful
6382 value.
6383 @end deffn
6384
6385 \fsymbol-set!
6386 @c snarfed from symbols.c:667
6387 @deffn primitive symbol-set! o s v
6388 Find the symbol in @var{obarray} whose name is @var{string}, and rebind
6389 it to @var{value}. An error is signalled if @var{string} is not present
6390 in @var{obarray}.
6391 @end deffn
6392
6393 \fsymbol-fref
6394 @c snarfed from symbols.c:684
6395 @deffn primitive symbol-fref s
6396 Return the contents of @var{symbol}'s @dfn{function slot}.
6397 @end deffn
6398
6399 \fsymbol-pref
6400 @c snarfed from symbols.c:695
6401 @deffn primitive symbol-pref s
6402 Return the @dfn{property list} currently associated with @var{symbol}.
6403 @end deffn
6404
6405 \fsymbol-fset!
6406 @c snarfed from symbols.c:706
6407 @deffn primitive symbol-fset! s val
6408 Change the binding of @var{symbol}'s function slot.
6409 @end deffn
6410
6411 \fsymbol-pset!
6412 @c snarfed from symbols.c:718
6413 @deffn primitive symbol-pset! s val
6414 Change the binding of @var{symbol}'s property slot.
6415 @end deffn
6416
6417 \fsymbol-hash
6418 @c snarfed from symbols.c:732
6419 @deffn primitive symbol-hash symbol
6420 Return a hash value for @var{symbol}.
6421 @end deffn
6422
6423 \fbuiltin-bindings
6424 @c snarfed from symbols.c:769
6425 @deffn primitive builtin-bindings
6426 Create and return a copy of the global symbol table, removing all
6427 unbound symbols.
6428 @end deffn
6429
6430 \fgensym
6431 @c snarfed from symbols.c:790
6432 @deffn primitive gensym [prefix]
6433 Create a new symbol with a name constructed from a prefix and
6434 a counter value. The string @var{prefix} can be specified as
6435 an optional argument. Default prefix is @code{g}. The counter
6436 is increased by 1 at each call. There is no provision for
6437 resetting the counter.
6438 @end deffn
6439
6440 \fgentemp
6441 @c snarfed from symbols.c:829
6442 @deffn primitive gentemp [prefix [obarray]]
6443 Create a new symbol with a name unique in an obarray.
6444 The name is constructed from an optional string @var{prefix}
6445 and a counter value. The default prefix is @code{t}. The
6446 @var{obarray} is specified as a second optional argument.
6447 Default is the system obarray where all normal symbols are
6448 interned. The counter is increased by 1 at each
6449 call. There is no provision for resetting the counter.
6450 @end deffn
6451
6452 \ftag
6453 @c snarfed from tag.c:98
6454 @deffn primitive tag x
6455 Return an integer corresponding to the type of X. Deprecated.
6456 @end deffn
6457
6458 \fcatch
6459 @c snarfed from throw.c:529
6460 @deffn primitive catch tag thunk handler
6461 Invoke @var{thunk} in the dynamic context of @var{handler} for
6462 exceptions matching @var{key}. If thunk throws to the symbol @var{key},
6463 then @var{handler} is invoked this way:
6464
6465 @example
6466 (handler key args ...)
6467 @end example
6468
6469 @var{key} is a symbol or #t.
6470
6471 @var{thunk} takes no arguments. If @var{thunk} returns normally, that
6472 is the return value of @code{catch}.
6473
6474 Handler is invoked outside the scope of its own @code{catch}. If
6475 @var{handler} again throws to the same key, a new handler from further
6476 up the call chain is invoked.
6477
6478 If the key is @code{#t}, then a throw to @emph{any} symbol will match
6479 this call to @code{catch}.
6480 @end deffn
6481
6482 \flazy-catch
6483 @c snarfed from throw.c:556
6484 @deffn primitive lazy-catch tag thunk handler
6485 This behaves exactly like @code{catch}, except that it does
6486 not unwind the stack (this is the major difference), and if
6487 handler returns, its value is returned from the throw.
6488 @end deffn
6489
6490 \fthrow
6491 @c snarfed from throw.c:589
6492 @deffn primitive throw key . args
6493 Invoke the catch form matching @var{key}, passing @var{args} to the
6494 @var{handler}.
6495
6496 @var{key} is a symbol. It will match catches of the same symbol or of
6497 #t.
6498
6499 If there is no handler at all, an error is signaled.
6500 @end deffn
6501
6502 \funiform-vector-length
6503 @c snarfed from unif.c:255
6504 @deffn primitive uniform-vector-length v
6505 Returns the number of elements in @var{uve}.
6506 @end deffn
6507
6508 \farray?
6509 @c snarfed from unif.c:289
6510 @deffn primitive array? v [prot]
6511 Returns @code{#t} if the @var{obj} is an array, and @code{#f} if not.
6512
6513 The @var{prototype} argument is used with uniform arrays and is described
6514 elsewhere.
6515 @end deffn
6516
6517 \farray-rank
6518 @c snarfed from unif.c:360
6519 @deffn primitive array-rank ra
6520 Returns the number of dimensions of @var{obj}. If @var{obj} is not an
6521 array, @code{0} is returned.
6522 @end deffn
6523
6524 \farray-dimensions
6525 @c snarfed from unif.c:398
6526 @deffn primitive array-dimensions ra
6527 @code{Array-dimensions} is similar to @code{array-shape} but replaces
6528 elements with a @code{0} minimum with one greater than the maximum. So:
6529 @example
6530 (array-dimensions (make-array 'foo '(-1 3) 5)) @result{} ((-1 3) 5)
6531 @end example
6532 @end deffn
6533
6534 \fshared-array-root
6535 @c snarfed from unif.c:445
6536 @deffn primitive shared-array-root ra
6537 Return the root vector of a shared array.
6538 @end deffn
6539
6540 \fshared-array-offset
6541 @c snarfed from unif.c:456
6542 @deffn primitive shared-array-offset ra
6543 Return the root vector index of the first element in the array.
6544 @end deffn
6545
6546 \fshared-array-increments
6547 @c snarfed from unif.c:467
6548 @deffn primitive shared-array-increments ra
6549 For each dimension, return the distance between elements in the root vector.
6550 @end deffn
6551
6552 \fdimensions->uniform-array
6553 @c snarfed from unif.c:586
6554 @deffn primitive dimensions->uniform-array dims prot [fill]
6555 @deffnx primitive make-uniform-vector length prototype [fill]
6556 Creates and returns a uniform array or vector of type corresponding to
6557 @var{prototype} with dimensions @var{dims} or length @var{length}. If
6558 @var{fill} is supplied, it's used to fill the array, otherwise
6559 @var{prototype} is used.
6560 @end deffn
6561
6562 \fmake-shared-array
6563 @c snarfed from unif.c:672
6564 @deffn primitive make-shared-array oldra mapfunc . dims
6565 @code{make-shared-array} can be used to create shared subarrays of other
6566 arrays. The @var{mapper} is a function that translates coordinates in
6567 the new array into coordinates in the old array. A @var{mapper} must be
6568 linear, and its range must stay within the bounds of the old array, but
6569 it can be otherwise arbitrary. A simple example:
6570 @example
6571 (define fred (make-array #f 8 8))
6572 (define freds-diagonal
6573 (make-shared-array fred (lambda (i) (list i i)) 8))
6574 (array-set! freds-diagonal 'foo 3)
6575 (array-ref fred 3 3) @result{} foo
6576 (define freds-center
6577 (make-shared-array fred (lambda (i j) (list (+ 3 i) (+ 3 j))) 2 2))
6578 (array-ref freds-center 0 0) @result{} foo
6579 @end example
6580 @end deffn
6581
6582 \ftranspose-array
6583 @c snarfed from unif.c:802
6584 @deffn primitive transpose-array ra . args
6585 Returns an array sharing contents with @var{array}, but with dimensions
6586 arranged in a different order. There must be one @var{dim} argument for
6587 each dimension of @var{array}. @var{dim0}, @var{dim1}, @dots{} should
6588 be integers between 0 and the rank of the array to be returned. Each
6589 integer in that range must appear at least once in the argument list.
6590
6591 The values of @var{dim0}, @var{dim1}, @dots{} correspond to dimensions
6592 in the array to be returned, their positions in the argument list to
6593 dimensions of @var{array}. Several @var{dim}s may have the same value,
6594 in which case the returned array will have smaller rank than
6595 @var{array}.
6596
6597 examples:
6598 @example
6599 (transpose-array '#2((a b) (c d)) 1 0) @result{} #2((a c) (b d))
6600 (transpose-array '#2((a b) (c d)) 0 0) @result{} #1(a d)
6601 (transpose-array '#3(((a b c) (d e f)) ((1 2 3) (4 5 6))) 1 1 0) @result{}
6602 #2((a 4) (b 5) (c 6))
6603 @end example
6604 @end deffn
6605
6606 \fenclose-array
6607 @c snarfed from unif.c:911
6608 @deffn primitive enclose-array ra . axes
6609 @var{dim0}, @var{dim1} @dots{} should be nonnegative integers less than
6610 the rank of @var{array}. @var{enclose-array} returns an array
6611 resembling an array of shared arrays. The dimensions of each shared
6612 array are the same as the @var{dim}th dimensions of the original array,
6613 the dimensions of the outer array are the same as those of the original
6614 array that did not match a @var{dim}.
6615
6616 An enclosed array is not a general Scheme array. Its elements may not
6617 be set using @code{array-set!}. Two references to the same element of
6618 an enclosed array will be @code{equal?} but will not in general be
6619 @code{eq?}. The value returned by @var{array-prototype} when given an
6620 enclosed array is unspecified.
6621
6622 examples:
6623 @example
6624 (enclose-array '#3(((a b c) (d e f)) ((1 2 3) (4 5 6))) 1) @result{}
6625 #<enclosed-array (#1(a d) #1(b e) #1(c f)) (#1(1 4) #1(2 5) #1(3 6))>
6626
6627 (enclose-array '#3(((a b c) (d e f)) ((1 2 3) (4 5 6))) 1 0) @result{}
6628 #<enclosed-array #2((a 1) (d 4)) #2((b 2) (e 5)) #2((c 3) (f 6))>
6629 @end example
6630 @end deffn
6631
6632 \farray-in-bounds?
6633 @c snarfed from unif.c:994
6634 @deffn primitive array-in-bounds? v . args
6635 Returns @code{#t} if its arguments would be acceptable to array-ref.
6636 @end deffn
6637
6638 \farray-ref
6639 @c snarfed from unif.c:1073
6640 @deffn primitive array-ref
6641 scm_uniform_vector_ref
6642 @end deffn
6643
6644 \funiform-vector-ref
6645 @c snarfed from unif.c:1079
6646 @deffn primitive uniform-vector-ref v args
6647 @deffnx primitive array-ref v . args
6648 Returns the element at the @code{(index1, index2)} element in @var{array}.
6649 @end deffn
6650
6651 \funiform-array-set1!
6652 @c snarfed from unif.c:1248
6653 @deffn primitive uniform-array-set1!
6654 scm_array_set_x
6655 @end deffn
6656
6657 \farray-set!
6658 @c snarfed from unif.c:1257
6659 @deffn primitive array-set! v obj . args
6660 @deffnx primitive uniform-array-set1! v obj args
6661 Sets the element at the @code{(index1, index2)} element in @var{array} to
6662 @var{new-value}. The value returned by array-set! is unspecified.
6663 @end deffn
6664
6665 \farray-contents
6666 @c snarfed from unif.c:1372
6667 @deffn primitive array-contents ra [strict]
6668 @deffnx primitive array-contents array strict
6669 If @var{array} may be @dfn{unrolled} into a one dimensional shared array
6670 without changing their order (last subscript changing fastest), then
6671 @code{array-contents} returns that shared array, otherwise it returns
6672 @code{#f}. All arrays made by @var{make-array} and
6673 @var{make-uniform-array} may be unrolled, some arrays made by
6674 @var{make-shared-array} may not be.
6675
6676 If the optional argument @var{strict} is provided, a shared array will
6677 be returned only if its elements are stored internally contiguous in
6678 memory.
6679 @end deffn
6680
6681 \funiform-array-read!
6682 @c snarfed from unif.c:1486
6683 @deffn primitive uniform-array-read! ra [port_or_fd [start [end]]]
6684 @deffnx primitive uniform-vector-read! uve [port-or-fdes] [start] [end]
6685 Attempts to read all elements of @var{ura}, in lexicographic order, as
6686 binary objects from @var{port-or-fdes}.
6687 If an end of file is encountered during
6688 uniform-array-read! the objects up to that point only are put into @var{ura}
6689 (starting at the beginning) and the remainder of the array is
6690 unchanged.
6691
6692 The optional arguments @var{start} and @var{end} allow
6693 a specified region of a vector (or linearized array) to be read,
6694 leaving the remainder of the vector unchanged.
6695
6696 @code{uniform-array-read!} returns the number of objects read.
6697 @var{port-or-fdes} may be omitted, in which case it defaults to the value
6698 returned by @code{(current-input-port)}.
6699 @end deffn
6700
6701 \funiform-array-write
6702 @c snarfed from unif.c:1649
6703 @deffn primitive uniform-array-write v [port_or_fd [start [end]]]
6704 @deffnx primitive uniform-vector-write uve [port-or-fdes] [start] [end]
6705 Writes all elements of @var{ura} as binary objects to
6706 @var{port-or-fdes}.
6707
6708 The optional arguments @var{start}
6709 and @var{end} allow
6710 a specified region of a vector (or linearized array) to be written.
6711
6712 The number of objects actually written is returned.
6713 @var{port-or-fdes} may be
6714 omitted, in which case it defaults to the value returned by
6715 @code{(current-output-port)}.
6716 @end deffn
6717
6718 \fbit-count
6719 @c snarfed from unif.c:1774
6720 @deffn primitive bit-count b bitvector
6721 Returns the number of occurrences of the boolean @var{b} in
6722 @var{bitvector}.
6723 @end deffn
6724
6725 \fbit-position
6726 @c snarfed from unif.c:1813
6727 @deffn primitive bit-position item v k
6728 Returns the minimum index of an occurrence of @var{bool} in @var{bv}
6729 which is at least @var{k}. If no @var{bool} occurs within the specified
6730 range @code{#f} is returned.
6731 @end deffn
6732
6733 \fbit-set*!
6734 @c snarfed from unif.c:1881
6735 @deffn primitive bit-set*! v kv obj
6736 If uve is a bit-vector @var{bv} and uve must be of the same
6737 length. If @var{bool} is @code{#t}, uve is OR'ed into
6738 @var{bv}; If @var{bool} is @code{#f}, the inversion of uve is
6739 AND'ed into @var{bv}.
6740
6741 If uve is a unsigned integer vector all the elements of uve
6742 must be between 0 and the @code{length} of @var{bv}. The bits
6743 of @var{bv} corresponding to the indexes in uve are set to
6744 @var{bool}. The return value is unspecified.
6745 @end deffn
6746
6747 \fbit-count*
6748 @c snarfed from unif.c:1935
6749 @deffn primitive bit-count* v kv obj
6750 Returns
6751 @example
6752 (bit-count (bit-set*! (if bool bv (bit-invert! bv)) uve #t) #t).
6753 @end example
6754 @var{bv} is not modified.
6755 @end deffn
6756
6757 \fbit-invert!
6758 @c snarfed from unif.c:1999
6759 @deffn primitive bit-invert! v
6760 Modifies @var{bv} by replacing each element with its negation.
6761 @end deffn
6762
6763 \farray->list
6764 @c snarfed from unif.c:2077
6765 @deffn primitive array->list v
6766 Returns a list consisting of all the elements, in order, of @var{array}.
6767 @end deffn
6768
6769 \flist->uniform-array
6770 @c snarfed from unif.c:2169
6771 @deffn primitive list->uniform-array ndim prot lst
6772 @deffnx procedure list->uniform-vector prot lst
6773 Returns a uniform array of the type indicated by prototype @var{prot}
6774 with elements the same as those of @var{lst}. Elements must be of the
6775 appropriate type, no coercions are done.
6776 @end deffn
6777
6778 \farray-prototype
6779 @c snarfed from unif.c:2520
6780 @deffn primitive array-prototype ra
6781 Returns an object that would produce an array of the same type as
6782 @var{array}, if used as the @var{prototype} for
6783 @code{make-uniform-array}.
6784 @end deffn
6785
6786 \fvalues
6787 @c snarfed from values.c:83
6788 @deffn primitive values . args
6789 Delivers all of its arguments to its continuation. Except for
6790 continuations created by the @code{call-with-values} procedure,
6791 all continuations take exactly one value. The effect of
6792 passing no value or more than one value to continuations that
6793 were not created by @code{call-with-values} is unspecified.
6794 @end deffn
6795
6796 \fcall-with-values
6797 @c snarfed from values.c:116
6798 @deffn primitive call-with-values producer consumer
6799 Calls its @var{producer} argument with no values and a
6800 continuation that, when passed some values, calls the
6801 @var{consumer} procedure with those values as arguments. The
6802 continuation for the call to @var{consumer} is the continuation
6803 of the call to @code{call-with-values}.
6804
6805 @example
6806 (call-with-values (lambda () (values 4 5))
6807 (lambda (a b) b))
6808 ==> 5
6809
6810 @end example
6811 @example
6812 (call-with-values * -) ==> -1
6813 @end example
6814 @end deffn
6815
6816 \fmake-variable
6817 @c snarfed from variable.c:100
6818 @deffn primitive make-variable init [name_hint]
6819 Return a variable object initialized to value @var{init}.
6820 If given, uses @var{name-hint} as its internal (debugging)
6821 name, otherwise just treat it as an anonymous variable.
6822 Remember, of course, that multiple bindings to the same
6823 variable may exist, so @var{name-hint} is just that---a hint.
6824 @end deffn
6825
6826 \fmake-undefined-variable
6827 @c snarfed from variable.c:124
6828 @deffn primitive make-undefined-variable [name_hint]
6829 Return a variable object initialized to an undefined value.
6830 If given, uses @var{name-hint} as its internal (debugging)
6831 name, otherwise just treat it as an anonymous variable.
6832 Remember, of course, that multiple bindings to the same
6833 variable may exist, so @var{name-hint} is just that---a hint.
6834 @end deffn
6835
6836 \fvariable?
6837 @c snarfed from variable.c:145
6838 @deffn primitive variable? obj
6839 Return @code{#t} iff @var{obj} is a variable object, else
6840 return @code{#f}
6841 @end deffn
6842
6843 \fvariable-ref
6844 @c snarfed from variable.c:157
6845 @deffn primitive variable-ref var
6846 Dereference @var{var} and return its value.
6847 @var{var} must be a variable object; see @code{make-variable}
6848 and @code{make-undefined-variable}.
6849 @end deffn
6850
6851 \fvariable-set!
6852 @c snarfed from variable.c:171
6853 @deffn primitive variable-set! var val
6854 Set the value of the variable @var{var} to @var{val}.
6855 @var{var} must be a variable object, @var{val} can be any
6856 value. Return an unspecified value.
6857 @end deffn
6858
6859 \fbuiltin-variable
6860 @c snarfed from variable.c:185
6861 @deffn primitive builtin-variable name
6862 Return the built-in variable with the name @var{name}.
6863 @var{name} must be a symbol (not a string).
6864 Then use @code{variable-ref} to access its value.
6865 @end deffn
6866
6867 \fvariable-bound?
6868 @c snarfed from variable.c:213
6869 @deffn primitive variable-bound? var
6870 Return @code{#t} iff @var{var} is bound to a value.
6871 Throws an error if @var{var} is not a variable object.
6872 @end deffn
6873
6874 \fvector?
6875 @c snarfed from vectors.c:142
6876 @deffn primitive vector? obj
6877 Returns @code{#t} if @var{obj} is a vector, otherwise returns
6878 @code{#f}. (r5rs)
6879 @end deffn
6880
6881 \flist->vector
6882 @c snarfed from vectors.c:161
6883 @deffn primitive list->vector
6884 scm_vector
6885 @end deffn
6886
6887 \fvector
6888 @c snarfed from vectors.c:177
6889 @deffn primitive vector . l
6890 @deffnx primitive list->vector l
6891 Returns a newly allocated vector whose elements contain the
6892 given arguments. Analogous to @code{list}. (r5rs)
6893
6894 @lisp
6895 (vector 'a 'b 'c) @result{} #(a b c)
6896 @end lisp
6897 @end deffn
6898
6899 \fmake-vector
6900 @c snarfed from vectors.c:255
6901 @deffn primitive make-vector k [fill]
6902 Returns a newly allocated vector of @var{k} elements. If a second
6903 argument is given, then each element is initialized to @var{fill}.
6904 Otherwise the initial contents of each element is unspecified. (r5rs)
6905 @end deffn
6906
6907 \fvector->list
6908 @c snarfed from vectors.c:311
6909 @deffn primitive vector->list v
6910 @samp{Vector->list} returns a newly allocated list of the
6911 objects contained in the elements of @var{vector}. (r5rs)
6912
6913 @lisp
6914 (vector->list '#(dah dah didah)) @result{} (dah dah didah)
6915 (list->vector '(dididit dah)) @result{} #(dididit dah)
6916 @end lisp
6917 @end deffn
6918
6919 \fvector-fill!
6920 @c snarfed from vectors.c:328
6921 @deffn primitive vector-fill! v fill_x
6922 Stores @var{fill} in every element of @var{vector}.
6923 The value returned by @code{vector-fill!} is unspecified. (r5rs)
6924 @end deffn
6925
6926 \fvector-move-left!
6927 @c snarfed from vectors.c:355
6928 @deffn primitive vector-move-left! vec1 start1 end1 vec2 start2
6929 Vector version of @code{substring-move-left!}.
6930 @end deffn
6931
6932 \fvector-move-right!
6933 @c snarfed from vectors.c:378
6934 @deffn primitive vector-move-right! vec1 start1 end1 vec2 start2
6935 Vector version of @code{substring-move-right!}.
6936 @end deffn
6937
6938 \fmajor-version
6939 @c snarfed from version.c:59
6940 @deffn primitive major-version
6941 Return a string containing Guile's major version number.
6942 E.g., "1".
6943 @end deffn
6944
6945 \fminor-version
6946 @c snarfed from version.c:71
6947 @deffn primitive minor-version
6948 Return a string containing Guile's minor version number.
6949 E.g., "3.5".
6950 @end deffn
6951
6952 \fversion
6953 @c snarfed from version.c:90
6954 @deffn primitive version
6955 @deffnx primitive major-version
6956 @deffnx primitive minor-version
6957 Return a string describing Guile's version number, or its major or minor
6958 version numbers, respectively.
6959
6960 @example
6961 (version) @result{} "1.3a"
6962 (major-version) @result{} "1"
6963 (minor-version) @result{} "3a"
6964 @end example
6965 @end deffn
6966
6967 \fmake-soft-port
6968 @c snarfed from vports.c:184
6969 @deffn primitive make-soft-port pv modes
6970 Returns a port capable of receiving or delivering characters as
6971 specified by the @var{modes} string (@pxref{File Ports,
6972 open-file}). @var{vector} must be a vector of length 6. Its components
6973 are as follows:
6974
6975 @enumerate 0
6976 @item
6977 procedure accepting one character for output
6978 @item
6979 procedure accepting a string for output
6980 @item
6981 thunk for flushing output
6982 @item
6983 thunk for getting one character
6984 @item
6985 thunk for closing port (not by garbage collection)
6986 @end enumerate
6987
6988 For an output-only port only elements 0, 1, 2, and 4 need be
6989 procedures. For an input-only port only elements 3 and 4 need be
6990 procedures. Thunks 2 and 4 can instead be @code{#f} if there is no useful
6991 operation for them to perform.
6992
6993 If thunk 3 returns @code{#f} or an @code{eof-object} (@pxref{Input,
6994 eof-object?, ,r4rs, The Revised^4 Report on Scheme}) it indicates that
6995 the port has reached end-of-file. For example:
6996
6997 @example
6998 (define stdout (current-output-port))
6999 (define p (make-soft-port
7000 (vector
7001 (lambda (c) (write c stdout))
7002 (lambda (s) (display s stdout))
7003 (lambda () (display "." stdout))
7004 (lambda () (char-upcase (read-char)))
7005 (lambda () (display "@@" stdout)))
7006 "rw"))
7007
7008 (write p p) @result{} #<input-output: soft 8081e20>
7009 @end example
7010 @end deffn
7011
7012 \fmake-weak-vector
7013 @c snarfed from weaks.c:62
7014 @deffn primitive make-weak-vector k [fill]
7015 Return a weak vector with @var{size} elements. If the optional
7016 argument @var{fill} is given, all entries in the vector will be set to
7017 @var{fill}. The default value for @var{fill} is the empty list.
7018 @end deffn
7019
7020 \flist->weak-vector
7021 @c snarfed from weaks.c:79
7022 @deffn primitive list->weak-vector
7023 scm_weak_vector
7024 @end deffn
7025
7026 \fweak-vector
7027 @c snarfed from weaks.c:87
7028 @deffn primitive weak-vector . l
7029 @deffnx primitive list->weak-vector l
7030 Construct a weak vector from a list: @code{weak-vector} uses the list of
7031 its arguments while @code{list->weak-vector} uses its only argument
7032 @var{l} (a list) to construct a weak vector the same way
7033 @code{vector->list} would.
7034 @end deffn
7035
7036 \fweak-vector?
7037 @c snarfed from weaks.c:110
7038 @deffn primitive weak-vector? x
7039 Return @code{#t} if @var{obj} is a weak vector. Note that all
7040 weak hashes are also weak vectors.
7041 @end deffn
7042
7043 \fmake-weak-key-hash-table
7044 @c snarfed from weaks.c:130
7045 @deffn primitive make-weak-key-hash-table k
7046 @deffnx primitive make-weak-value-hash-table size
7047 @deffnx primitive make-doubly-weak-hash-table size
7048 Return a weak hash table with @var{size} buckets. As with any hash
7049 table, choosing a good size for the table requires some caution.
7050
7051 You can modify weak hash tables in exactly the same way you would modify
7052 regular hash tables. (@pxref{Hash Tables})
7053 @end deffn
7054
7055 \fmake-weak-value-hash-table
7056 @c snarfed from weaks.c:147
7057 @deffn primitive make-weak-value-hash-table k
7058 Return a hash table with weak values with @var{size} buckets.
7059 (@pxref{Hash Tables})
7060 @end deffn
7061
7062 \fmake-doubly-weak-hash-table
7063 @c snarfed from weaks.c:165
7064 @deffn primitive make-doubly-weak-hash-table k
7065 Return a hash table with weak keys and values with @var{size}
7066 buckets. (@pxref{Hash Tables})
7067 @end deffn
7068
7069 \fweak-key-hash-table?
7070 @c snarfed from weaks.c:184
7071 @deffn primitive weak-key-hash-table? x
7072 @deffnx primitive weak-value-hash-table? obj
7073 @deffnx primitive doubly-weak-hash-table? obj
7074 Return @code{#t} if @var{obj} is the specified weak hash
7075 table. Note that a doubly weak hash table is neither a weak key
7076 nor a weak value hash table.
7077 @end deffn
7078
7079 \fweak-value-hash-table?
7080 @c snarfed from weaks.c:194
7081 @deffn primitive weak-value-hash-table? x
7082 Return @code{#t} if @var{x} is a weak value hash table.
7083 @end deffn
7084
7085 \fdoubly-weak-hash-table?
7086 @c snarfed from weaks.c:204
7087 @deffn primitive doubly-weak-hash-table? x
7088 Return @code{#t} if @var{x} is a doubly weak hash table.
7089 @end deffn