/[guile]/guile/guile-core/doc/ref/scheme-data.texi
ViewVC logotype

Diff of /guile/guile-core/doc/ref/scheme-data.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.5 by ttn, Tue Jan 8 09:22:36 2002 UTC revision 1.1.2.6 by ossau, Fri Mar 15 09:23:18 2002 UTC
# Line 123  number 0 (like in C and C++), and not th Line 123  number 0 (like in C and C++), and not th
123  The @code{not} procedure returns the boolean inverse of its argument:  The @code{not} procedure returns the boolean inverse of its argument:
124    
125  @rnindex not  @rnindex not
126  @deffn primitive not x  @deffn {Scheme Procedure} not x
127    @deffnx {C Function} scm_not (x)
128  Return @code{#t} iff @var{x} is @code{#f}, else return @code{#f}.  Return @code{#t} iff @var{x} is @code{#f}, else return @code{#f}.
129  @end deffn  @end deffn
130    
# Line 131  The @code{boolean?} procedure is a predi Line 132  The @code{boolean?} procedure is a predi
132  its argument is one of the boolean values, otherwise @code{#f}.  its argument is one of the boolean values, otherwise @code{#f}.
133    
134  @rnindex boolean?  @rnindex boolean?
135  @deffn primitive boolean? obj  @deffn {Scheme Procedure} boolean? obj
136    @deffnx {C Function} scm_boolean_p (obj)
137  Return @code{#t} iff @var{obj} is either @code{#t} or @code{#f}.  Return @code{#t} iff @var{obj} is either @code{#t} or @code{#f}.
138  @end deffn  @end deffn
139    
# Line 205  converted by Guile to the corresponding Line 207  converted by Guile to the corresponding
207  The @code{number?} predicate may be applied to any Scheme value to  The @code{number?} predicate may be applied to any Scheme value to
208  discover whether the value is any of the supported numerical types.  discover whether the value is any of the supported numerical types.
209    
210  @deffn primitive number? obj  @deffn {Scheme Procedure} number? obj
211  Return @code{#t} if @var{obj} is any kind of number, @code{#f} otherwise.  Return @code{#t} if @var{obj} is any kind of number, @code{#f} otherwise.
212  @end deffn  @end deffn
213    
# Line 275  completely invisible to the Scheme level Line 277  completely invisible to the Scheme level
277  @c REFFIXME Maybe point here to discussion of handling immediates/bignums  @c REFFIXME Maybe point here to discussion of handling immediates/bignums
278  @c on the C level, where the conversion is not so automatic - NJ  @c on the C level, where the conversion is not so automatic - NJ
279    
280  @deffn primitive integer? x  @deffn {Scheme Procedure} integer? x
281    @deffnx {C Function} scm_integer_p (x)
282  Return @code{#t} if @var{x} is an integer number, @code{#f} otherwise.  Return @code{#t} if @var{x} is an integer number, @code{#f} otherwise.
283    
284  @lisp  @lisp
# Line 338  rational numbers and real irrational num Line 341  rational numbers and real irrational num
341  and in such a way that the new kinds of number integrate seamlessly  and in such a way that the new kinds of number integrate seamlessly
342  with those that are already implemented.  with those that are already implemented.
343    
344  @deffn primitive real? obj  @deffn {Scheme Procedure} real? obj
345  Return @code{#t} if @var{obj} is a real number, @code{#f} otherwise.  Return @code{#t} if @var{obj} is a real number, @code{#f} otherwise.
346  Note that the sets of integer and rational values form subsets  Note that the sets of integer and rational values form subsets
347  of the set of real numbers, so the predicate will also be fulfilled  of the set of real numbers, so the predicate will also be fulfilled
348  if @var{obj} is an integer number or a rational number.  if @var{obj} is an integer number or a rational number.
349  @end deffn  @end deffn
350    
351  @deffn primitive rational? x  @deffn {Scheme Procedure} rational? x
352    @deffnx {C Function} scm_real_p (x)
353  Return @code{#t} if @var{x} is a rational number, @code{#f}  Return @code{#t} if @var{x} is a rational number, @code{#f}
354  otherwise.  Note that the set of integer values forms a subset of  otherwise.  Note that the set of integer values forms a subset of
355  the set of rational numbers, i. e. the predicate will also be  the set of rational numbers, i. e. the predicate will also be
# Line 384  Guile represents a complex number as a p Line 388  Guile represents a complex number as a p
388  real, so the real and imaginary parts of a complex number have the same  real, so the real and imaginary parts of a complex number have the same
389  properties of inexactness and limited precision as single real numbers.  properties of inexactness and limited precision as single real numbers.
390    
391  @deffn primitive complex? x  @deffn {Scheme Procedure} complex? x
392    @deffnx {C Function} scm_number_p (x)
393  Return @code{#t} if @var{x} is a complex number, @code{#f}  Return @code{#t} if @var{x} is a complex number, @code{#f}
394  otherwise.  Note that the sets of real, rational and integer  otherwise.  Note that the sets of real, rational and integer
395  values form subsets of the set of complex numbers, i. e. the  values form subsets of the set of complex numbers, i. e. the
# Line 411  available, has no fractional part, and i Line 416  available, has no fractional part, and i
416  will only convert the latter value to the former when forced to do so by  will only convert the latter value to the former when forced to do so by
417  an invocation of the @code{inexact->exact} procedure.  an invocation of the @code{inexact->exact} procedure.
418    
419  @deffn primitive exact? x  @deffn {Scheme Procedure} exact? x
420    @deffnx {C Function} scm_exact_p (x)
421  Return @code{#t} if @var{x} is an exact number, @code{#f}  Return @code{#t} if @var{x} is an exact number, @code{#f}
422  otherwise.  otherwise.
423  @end deffn  @end deffn
424    
425  @deffn primitive inexact? x  @deffn {Scheme Procedure} inexact? x
426    @deffnx {C Function} scm_inexact_p (x)
427  Return @code{#t} if @var{x} is an inexact number, @code{#f}  Return @code{#t} if @var{x} is an inexact number, @code{#f}
428  otherwise.  else.
429  @end deffn  @end deffn
430    
431  @deffn primitive inexact->exact z  @deffn {Scheme Procedure} inexact->exact z
432    @deffnx {C Function} scm_inexact_to_exact (z)
433  Return an exact number that is numerically closest to @var{z}.  Return an exact number that is numerically closest to @var{z}.
434  @end deffn  @end deffn
435    
436  @c begin (texi-doc-string "guile" "exact->inexact")  @c begin (texi-doc-string "guile" "exact->inexact")
437  @deffn primitive exact->inexact z  @deffn {Scheme Procedure} exact->inexact z
438  Convert the number @var{z} to its inexact representation.  Convert the number @var{z} to its inexact representation.
439  @end deffn  @end deffn
440    
# Line 508  multiplying by 10^N. Line 516  multiplying by 10^N.
516  @rnindex gcd  @rnindex gcd
517  @rnindex lcm  @rnindex lcm
518    
519  @deffn primitive odd? n  @deffn {Scheme Procedure} odd? n
520    @deffnx {C Function} scm_odd_p (n)
521  Return @code{#t} if @var{n} is an odd number, @code{#f}  Return @code{#t} if @var{n} is an odd number, @code{#f}
522  otherwise.  otherwise.
523  @end deffn  @end deffn
524    
525  @deffn primitive even? n  @deffn {Scheme Procedure} even? n
526    @deffnx {C Function} scm_even_p (n)
527  Return @code{#t} if @var{n} is an even number, @code{#f}  Return @code{#t} if @var{n} is an even number, @code{#f}
528  otherwise.  otherwise.
529  @end deffn  @end deffn
530    
531  @c begin (texi-doc-string "guile" "quotient")  @c begin (texi-doc-string "guile" "quotient")
532  @deffn primitive quotient  @deffn {Scheme Procedure} quotient
533  Return the quotient of the numbers @var{x} and @var{y}.  Return the quotient of the numbers @var{x} and @var{y}.
534  @end deffn  @end deffn
535    
536  @c begin (texi-doc-string "guile" "remainder")  @c begin (texi-doc-string "guile" "remainder")
537  @deffn primitive remainder  @deffn {Scheme Procedure} remainder
538  Return the remainder of the numbers @var{x} and @var{y}.  Return the remainder of the numbers @var{x} and @var{y}.
539  @lisp  @lisp
540  (remainder 13 4) @result{} 1  (remainder 13 4) @result{} 1
# Line 533  Return the remainder of the numbers @var Line 543  Return the remainder of the numbers @var
543  @end deffn  @end deffn
544    
545  @c begin (texi-doc-string "guile" "modulo")  @c begin (texi-doc-string "guile" "modulo")
546  @deffn primitive modulo  @deffn {Scheme Procedure} modulo
547  Return the modulo of the numbers @var{x} and @var{y}.  Return the modulo of the numbers @var{x} and @var{y}.
548  @lisp  @lisp
549  (modulo 13 4) @result{} 1  (modulo 13 4) @result{} 1
# Line 542  Return the modulo of the numbers @var{x} Line 552  Return the modulo of the numbers @var{x}
552  @end deffn  @end deffn
553    
554  @c begin (texi-doc-string "guile" "gcd")  @c begin (texi-doc-string "guile" "gcd")
555  @deffn primitive gcd  @deffn {Scheme Procedure} gcd
556  Return the greatest common divisor of all arguments.  Return the greatest common divisor of all arguments.
557  If called without arguments, 0 is returned.  If called without arguments, 0 is returned.
558  @end deffn  @end deffn
559    
560  @c begin (texi-doc-string "guile" "lcm")  @c begin (texi-doc-string "guile" "lcm")
561  @deffn primitive lcm  @deffn {Scheme Procedure} lcm
562  Return the least common multiple of the arguments.  Return the least common multiple of the arguments.
563  If called without arguments, 1 is returned.  If called without arguments, 1 is returned.
564  @end deffn  @end deffn
# Line 561  If called without arguments, 1 is return Line 571  If called without arguments, 1 is return
571  @rnindex negative?  @rnindex negative?
572    
573  @c begin (texi-doc-string "guile" "=")  @c begin (texi-doc-string "guile" "=")
574  @deffn primitive =  @deffn {Scheme Procedure} =
575  Return @code{#t} if all parameters are numerically equal.  Return @code{#t} if all parameters are numerically equal.
576  @end deffn  @end deffn
577    
578  @c begin (texi-doc-string "guile" "<")  @c begin (texi-doc-string "guile" "<")
579  @deffn primitive <  @deffn {Scheme Procedure} <
580  Return @code{#t} if the list of parameters is monotonically  Return @code{#t} if the list of parameters is monotonically
581  increasing.  increasing.
582  @end deffn  @end deffn
583    
584  @c begin (texi-doc-string "guile" ">")  @c begin (texi-doc-string "guile" ">")
585  @deffn primitive >  @deffn {Scheme Procedure} >
586  Return @code{#t} if the list of parameters is monotonically  Return @code{#t} if the list of parameters is monotonically
587  decreasing.  decreasing.
588  @end deffn  @end deffn
589    
590  @c begin (texi-doc-string "guile" "<=")  @c begin (texi-doc-string "guile" "<=")
591  @deffn primitive <=  @deffn {Scheme Procedure} <=
592  Return @code{#t} if the list of parameters is monotonically  Return @code{#t} if the list of parameters is monotonically
593  non-decreasing.  non-decreasing.
594  @end deffn  @end deffn
595    
596  @c begin (texi-doc-string "guile" ">=")  @c begin (texi-doc-string "guile" ">=")
597  @deffn primitive >=  @deffn {Scheme Procedure} >=
598  Return @code{#t} if the list of parameters is monotonically  Return @code{#t} if the list of parameters is monotonically
599  non-increasing.  non-increasing.
600  @end deffn  @end deffn
601    
602  @c begin (texi-doc-string "guile" "zero?")  @c begin (texi-doc-string "guile" "zero?")
603  @deffn primitive zero?  @deffn {Scheme Procedure} zero?
604  Return @code{#t} if @var{z} is an exact or inexact number equal to  Return @code{#t} if @var{z} is an exact or inexact number equal to
605  zero.  zero.
606  @end deffn  @end deffn
607    
608  @c begin (texi-doc-string "guile" "positive?")  @c begin (texi-doc-string "guile" "positive?")
609  @deffn primitive positive?  @deffn {Scheme Procedure} positive?
610  Return @code{#t} if @var{x} is an exact or inexact number greater than  Return @code{#t} if @var{x} is an exact or inexact number greater than
611  zero.  zero.
612  @end deffn  @end deffn
613    
614  @c begin (texi-doc-string "guile" "negative?")  @c begin (texi-doc-string "guile" "negative?")
615  @deffn primitive negative?  @deffn {Scheme Procedure} negative?
616  Return @code{#t} if @var{x} is an exact or inexact number less than  Return @code{#t} if @var{x} is an exact or inexact number less than
617  zero.  zero.
618  @end deffn  @end deffn
# Line 613  zero. Line 623  zero.
623  @rnindex number->string  @rnindex number->string
624  @rnindex string->number  @rnindex string->number
625    
626  @deffn primitive number->string n [radix]  @deffn {Scheme Procedure} number->string n [radix]
627    @deffnx {C Function} scm_number_to_string (n, radix)
628  Return a string holding the external representation of the  Return a string holding the external representation of the
629  number @var{n} in the given @var{radix}.  If @var{n} is  number @var{n} in the given @var{radix}.  If @var{n} is
630  inexact, a radix of 10 will be used.  inexact, a radix of 10 will be used.
631  @end deffn  @end deffn
632    
633  @deffn primitive string->number string [radix]  @deffn {Scheme Procedure} string->number string [radix]
634    @deffnx {C Function} scm_string_to_number (string, radix)
635  Return a number of the maximally precise representation  Return a number of the maximally precise representation
636  expressed by the given @var{string}. @var{radix} must be an  expressed by the given @var{string}. @var{radix} must be an
637  exact integer, either 2, 8, 10, or 16. If supplied, @var{radix}  exact integer, either 2, 8, 10, or 16. If supplied, @var{radix}
# Line 640  syntactically valid notation for a numbe Line 652  syntactically valid notation for a numbe
652  @rnindex magnitude  @rnindex magnitude
653  @rnindex angle  @rnindex angle
654    
655  @deffn primitive make-rectangular real imaginary  @deffn {Scheme Procedure} make-rectangular real imaginary
656    @deffnx {C Function} scm_make_rectangular (real, imaginary)
657  Return a complex number constructed of the given @var{real} and  Return a complex number constructed of the given @var{real} and
658  @var{imaginary} parts.  @var{imaginary} parts.
659  @end deffn  @end deffn
660    
661  @deffn primitive make-polar x y  @deffn {Scheme Procedure} make-polar x y
662    @deffnx {C Function} scm_make_polar (x, y)
663  Return the complex number @var{x} * e^(i * @var{y}).  Return the complex number @var{x} * e^(i * @var{y}).
664  @end deffn  @end deffn
665    
666  @c begin (texi-doc-string "guile" "real-part")  @c begin (texi-doc-string "guile" "real-part")
667  @deffn primitive real-part  @deffn {Scheme Procedure} real-part
668  Return the real part of the number @var{z}.  Return the real part of the number @var{z}.
669  @end deffn  @end deffn
670    
671  @c begin (texi-doc-string "guile" "imag-part")  @c begin (texi-doc-string "guile" "imag-part")
672  @deffn primitive imag-part  @deffn {Scheme Procedure} imag-part
673  Return the imaginary part of the number @var{z}.  Return the imaginary part of the number @var{z}.
674  @end deffn  @end deffn
675    
676  @c begin (texi-doc-string "guile" "magnitude")  @c begin (texi-doc-string "guile" "magnitude")
677  @deffn primitive magnitude  @deffn {Scheme Procedure} magnitude
678  Return the magnitude of the number @var{z}. This is the same as  Return the magnitude of the number @var{z}. This is the same as
679  @code{abs} for real arguments, but also allows complex numbers.  @code{abs} for real arguments, but also allows complex numbers.
680  @end deffn  @end deffn
681    
682  @c begin (texi-doc-string "guile" "angle")  @c begin (texi-doc-string "guile" "angle")
683  @deffn primitive angle  @deffn {Scheme Procedure} angle
684  Return the angle of the complex number @var{z}.  Return the angle of the complex number @var{z}.
685  @end deffn  @end deffn
686    
# Line 686  Return the angle of the complex number @ Line 700  Return the angle of the complex number @
700  @rnindex round  @rnindex round
701    
702  @c begin (texi-doc-string "guile" "+")  @c begin (texi-doc-string "guile" "+")
703  @deffn primitive + z1 @dots{}  @deffn {Scheme Procedure} + z1 @dots{}
704  Return the sum of all parameter values.  Return 0 if called without any  Return the sum of all parameter values.  Return 0 if called without any
705  parameters.  parameters.
706  @end deffn  @end deffn
707    
708  @c begin (texi-doc-string "guile" "-")  @c begin (texi-doc-string "guile" "-")
709  @deffn primitive - z1 z2 @dots{}  @deffn {Scheme Procedure} - z1 z2 @dots{}
710  If called with one argument @var{z1}, -@var{z1} is returned. Otherwise  If called with one argument @var{z1}, -@var{z1} is returned. Otherwise
711  the sum of all but the first argument are subtracted from the first  the sum of all but the first argument are subtracted from the first
712  argument.  argument.
713  @end deffn  @end deffn
714    
715  @c begin (texi-doc-string "guile" "*")  @c begin (texi-doc-string "guile" "*")
716  @deffn primitive * z1 @dots{}  @deffn {Scheme Procedure} * z1 @dots{}
717  Return the product of all arguments.  If called without arguments, 1 is  Return the product of all arguments.  If called without arguments, 1 is
718  returned.  returned.
719  @end deffn  @end deffn
720    
721  @c begin (texi-doc-string "guile" "/")  @c begin (texi-doc-string "guile" "/")
722  @deffn primitive / z1 z2 @dots{}  @deffn {Scheme Procedure} / z1 z2 @dots{}
723  Divide the first argument by the product of the remaining arguments.  If  Divide the first argument by the product of the remaining arguments.  If
724  called with one argument @var{z1}, 1/@var{z1} is returned.  called with one argument @var{z1}, 1/@var{z1} is returned.
725  @end deffn  @end deffn
726    
727  @c begin (texi-doc-string "guile" "abs")  @c begin (texi-doc-string "guile" "abs")
728  @deffn primitive abs x  @deffn {Scheme Procedure} abs x
729  Return the absolute value of @var{x}.  Return the absolute value of @var{x}.
730  @end deffn  @end deffn
731    
732  @c begin (texi-doc-string "guile" "max")  @c begin (texi-doc-string "guile" "max")
733  @deffn primitive max x1 x2 @dots{}  @deffn {Scheme Procedure} max x1 x2 @dots{}
734  Return the maximum of all parameter values.  Return the maximum of all parameter values.
735  @end deffn  @end deffn
736    
737  @c begin (texi-doc-string "guile" "min")  @c begin (texi-doc-string "guile" "min")
738  @deffn primitive min x1 x2 @dots{}  @deffn {Scheme Procedure} min x1 x2 @dots{}
739  Return the minmium of all parameter values.  Return the minmium of all parameter values.
740  @end deffn  @end deffn
741    
742  @c begin (texi-doc-string "guile" "truncate")  @c begin (texi-doc-string "guile" "truncate")
743  @deffn primitive truncate  @deffn {Scheme Procedure} truncate
744  Round the inexact number @var{x} towards zero.  Round the inexact number @var{x} towards zero.
745  @end deffn  @end deffn
746    
747  @c begin (texi-doc-string "guile" "round")  @c begin (texi-doc-string "guile" "round")
748  @deffn primitive round x  @deffn {Scheme Procedure} round x
749  Round the inexact number @var{x} towards zero.  Round the inexact number @var{x} towards zero.
750  @end deffn  @end deffn
751    
752  @c begin (texi-doc-string "guile" "floor")  @c begin (texi-doc-string "guile" "floor")
753  @deffn primitive floor x  @deffn {Scheme Procedure} floor x
754  Round the number @var{x} towards minus infinity.  Round the number @var{x} towards minus infinity.
755  @end deffn  @end deffn
756    
757  @c begin (texi-doc-string "guile" "ceiling")  @c begin (texi-doc-string "guile" "ceiling")
758  @deffn primitive ceiling x  @deffn {Scheme Procedure} ceiling x
759  Round the number @var{x} towards infinity.  Round the number @var{x} towards infinity.
760  @end deffn  @end deffn
761    
# Line 754  including complex numbers. Line 768  including complex numbers.
768    
769  @rnindex sqrt  @rnindex sqrt
770  @c begin (texi-doc-string "guile" "sqrt")  @c begin (texi-doc-string "guile" "sqrt")
771  @deffn procedure sqrt z  @deffn {Scheme Procedure} sqrt z
772  Return the square root of @var{z}.  Return the square root of @var{z}.
773  @end deffn  @end deffn
774    
775  @rnindex expt  @rnindex expt
776  @c begin (texi-doc-string "guile" "expt")  @c begin (texi-doc-string "guile" "expt")
777  @deffn procedure expt z1 z2  @deffn {Scheme Procedure} expt z1 z2
778  Return @var{z1} raised to the power of @var{z2}.  Return @var{z1} raised to the power of @var{z2}.
779  @end deffn  @end deffn
780    
781  @rnindex sin  @rnindex sin
782  @c begin (texi-doc-string "guile" "sin")  @c begin (texi-doc-string "guile" "sin")
783  @deffn procedure sin z  @deffn {Scheme Procedure} sin z
784  Return the sine of @var{z}.  Return the sine of @var{z}.
785  @end deffn  @end deffn
786    
787  @rnindex cos  @rnindex cos
788  @c begin (texi-doc-string "guile" "cos")  @c begin (texi-doc-string "guile" "cos")
789  @deffn procedure cos z  @deffn {Scheme Procedure} cos z
790  Return the cosine of @var{z}.  Return the cosine of @var{z}.
791  @end deffn  @end deffn
792    
793  @rnindex tan  @rnindex tan
794  @c begin (texi-doc-string "guile" "tan")  @c begin (texi-doc-string "guile" "tan")
795  @deffn procedure tan z  @deffn {Scheme Procedure} tan z
796  Return the tangent of @var{z}.  Return the tangent of @var{z}.
797  @end deffn  @end deffn
798    
799  @rnindex asin  @rnindex asin
800  @c begin (texi-doc-string "guile" "asin")  @c begin (texi-doc-string "guile" "asin")
801  @deffn procedure asin z  @deffn {Scheme Procedure} asin z
802  Return the arcsine of @var{z}.  Return the arcsine of @var{z}.
803  @end deffn  @end deffn
804    
805  @rnindex acos  @rnindex acos
806  @c begin (texi-doc-string "guile" "acos")  @c begin (texi-doc-string "guile" "acos")
807  @deffn procedure acos z  @deffn {Scheme Procedure} acos z
808  Return the arccosine of @var{z}.  Return the arccosine of @var{z}.
809  @end deffn  @end deffn
810    
811  @rnindex atan  @rnindex atan
812  @c begin (texi-doc-string "guile" "atan")  @c begin (texi-doc-string "guile" "atan")
813  @deffn procedure atan z  @deffn {Scheme Procedure} atan z
814  Return the arctangent of @var{z}.  Return the arctangent of @var{z}.
815  @end deffn  @end deffn
816    
817  @rnindex exp  @rnindex exp
818  @c begin (texi-doc-string "guile" "exp")  @c begin (texi-doc-string "guile" "exp")
819  @deffn procedure exp z  @deffn {Scheme Procedure} exp z
820  Return e to the power of @var{z}, where e is the base of natural  Return e to the power of @var{z}, where e is the base of natural
821  logarithms (2.71828@dots{}).  logarithms (2.71828@dots{}).
822  @end deffn  @end deffn
823    
824  @rnindex log  @rnindex log
825  @c begin (texi-doc-string "guile" "log")  @c begin (texi-doc-string "guile" "log")
826  @deffn procedure log z  @deffn {Scheme Procedure} log z
827  Return the natural logarithm of @var{z}.  Return the natural logarithm of @var{z}.
828  @end deffn  @end deffn
829    
830  @c begin (texi-doc-string "guile" "log10")  @c begin (texi-doc-string "guile" "log10")
831  @deffn procedure log10 z  @deffn {Scheme Procedure} log10 z
832  Return the base 10 logarithm of @var{z}.  Return the base 10 logarithm of @var{z}.
833  @end deffn  @end deffn
834    
835  @c begin (texi-doc-string "guile" "sinh")  @c begin (texi-doc-string "guile" "sinh")
836  @deffn procedure sinh z  @deffn {Scheme Procedure} sinh z
837  Return the hyperbolic sine of @var{z}.  Return the hyperbolic sine of @var{z}.
838  @end deffn  @end deffn
839    
840  @c begin (texi-doc-string "guile" "cosh")  @c begin (texi-doc-string "guile" "cosh")
841  @deffn procedure cosh z  @deffn {Scheme Procedure} cosh z
842  Return the hyperbolic cosine of @var{z}.  Return the hyperbolic cosine of @var{z}.
843  @end deffn  @end deffn
844    
845  @c begin (texi-doc-string "guile" "tanh")  @c begin (texi-doc-string "guile" "tanh")
846  @deffn procedure tanh z  @deffn {Scheme Procedure} tanh z
847  Return the hyperbolic tangent of @var{z}.  Return the hyperbolic tangent of @var{z}.
848  @end deffn  @end deffn
849    
850  @c begin (texi-doc-string "guile" "asinh")  @c begin (texi-doc-string "guile" "asinh")
851  @deffn procedure asinh z  @deffn {Scheme Procedure} asinh z
852  Return the hyperbolic arcsine of @var{z}.  Return the hyperbolic arcsine of @var{z}.
853  @end deffn  @end deffn
854    
855  @c begin (texi-doc-string "guile" "acosh")  @c begin (texi-doc-string "guile" "acosh")
856  @deffn procedure acosh z  @deffn {Scheme Procedure} acosh z
857  Return the hyperbolic arccosine of @var{z}.  Return the hyperbolic arccosine of @var{z}.
858  @end deffn  @end deffn
859    
860  @c begin (texi-doc-string "guile" "atanh")  @c begin (texi-doc-string "guile" "atanh")
861  @deffn procedure atanh z  @deffn {Scheme Procedure} atanh z
862  Return the hyperbolic arctangent of @var{z}.  Return the hyperbolic arctangent of @var{z}.
863  @end deffn  @end deffn
864    
# Line 858  procedures that use the following real n Line 872  procedures that use the following real n
872  primitives signal an error if they are called with complex arguments.  primitives signal an error if they are called with complex arguments.
873    
874  @c begin (texi-doc-string "guile" "$abs")  @c begin (texi-doc-string "guile" "$abs")
875  @deffn primitive $abs x  @deffn {Scheme Procedure} $abs x
876  Return the absolute value of @var{x}.  Return the absolute value of @var{x}.
877  @end deffn  @end deffn
878    
879  @c begin (texi-doc-string "guile" "$sqrt")  @c begin (texi-doc-string "guile" "$sqrt")
880  @deffn primitive $sqrt x  @deffn {Scheme Procedure} $sqrt x
881  Return the square root of @var{x}.  Return the square root of @var{x}.
882  @end deffn  @end deffn
883    
884  @deffn primitive $expt x y  @deffn {Scheme Procedure} $expt x y
885    @deffnx {C Function} scm_sys_expt (x, y)
886  Return @var{x} raised to the power of @var{y}. This  Return @var{x} raised to the power of @var{y}. This
887  procedure does not accept complex arguments.  procedure does not accept complex arguments.
888  @end deffn  @end deffn
889    
890  @c begin (texi-doc-string "guile" "$sin")  @c begin (texi-doc-string "guile" "$sin")
891  @deffn primitive $sin x  @deffn {Scheme Procedure} $sin x
892  Return the sine of @var{x}.  Return the sine of @var{x}.
893  @end deffn  @end deffn
894    
895  @c begin (texi-doc-string "guile" "$cos")  @c begin (texi-doc-string "guile" "$cos")
896  @deffn primitive $cos x  @deffn {Scheme Procedure} $cos x
897  Return the cosine of @var{x}.  Return the cosine of @var{x}.
898  @end deffn  @end deffn
899    
900  @c begin (texi-doc-string "guile" "$tan")  @c begin (texi-doc-string "guile" "$tan")
901  @deffn primitive $tan x  @deffn {Scheme Procedure} $tan x
902  Return the tangent of @var{x}.  Return the tangent of @var{x}.
903  @end deffn  @end deffn
904    
905  @c begin (texi-doc-string "guile" "$asin")  @c begin (texi-doc-string "guile" "$asin")
906  @deffn primitive $asin x  @deffn {Scheme Procedure} $asin x
907  Return the arcsine of @var{x}.  Return the arcsine of @var{x}.
908  @end deffn  @end deffn
909    
910  @c begin (texi-doc-string "guile" "$acos")  @c begin (texi-doc-string "guile" "$acos")
911  @deffn primitive $acos x  @deffn {Scheme Procedure} $acos x
912  Return the arccosine of @var{x}.  Return the arccosine of @var{x}.
913  @end deffn  @end deffn
914    
915  @c begin (texi-doc-string "guile" "$atan")  @c begin (texi-doc-string "guile" "$atan")
916  @deffn primitive $atan x  @deffn {Scheme Procedure} $atan x
917  Return the arctangent of @var{x} in the range -PI/2 to PI/2.  Return the arctangent of @var{x} in the range -PI/2 to PI/2.
918  @end deffn  @end deffn
919    
920  @deffn primitive $atan2 x y  @deffn {Scheme Procedure} $atan2 x y
921    @deffnx {C Function} scm_sys_atan2 (x, y)
922  Return the arc tangent of the two arguments @var{x} and  Return the arc tangent of the two arguments @var{x} and
923  @var{y}. This is similar to calculating the arc tangent of  @var{y}. This is similar to calculating the arc tangent of
924  @var{x} / @var{y}, except that the signs of both arguments  @var{x} / @var{y}, except that the signs of both arguments
# Line 911  procedure does not accept complex argume Line 927  procedure does not accept complex argume
927  @end deffn  @end deffn
928    
929  @c begin (texi-doc-string "guile" "$exp")  @c begin (texi-doc-string "guile" "$exp")
930  @deffn primitive $exp x  @deffn {Scheme Procedure} $exp x
931  Return e to the power of @var{x}, where e is the base of natural  Return e to the power of @var{x}, where e is the base of natural
932  logarithms (2.71828@dots{}).  logarithms (2.71828@dots{}).
933  @end deffn  @end deffn
934    
935  @c begin (texi-doc-string "guile" "$log")  @c begin (texi-doc-string "guile" "$log")
936  @deffn primitive $log x  @deffn {Scheme Procedure} $log x
937  Return the natural logarithm of @var{x}.  Return the natural logarithm of @var{x}.
938  @end deffn  @end deffn
939    
940  @c begin (texi-doc-string "guile" "$sinh")  @c begin (texi-doc-string "guile" "$sinh")
941  @deffn primitive $sinh x  @deffn {Scheme Procedure} $sinh x
942  Return the hyperbolic sine of @var{x}.  Return the hyperbolic sine of @var{x}.
943  @end deffn  @end deffn
944    
945  @c begin (texi-doc-string "guile" "$cosh")  @c begin (texi-doc-string "guile" "$cosh")
946  @deffn primitive $cosh x  @deffn {Scheme Procedure} $cosh x
947  Return the hyperbolic cosine of @var{x}.  Return the hyperbolic cosine of @var{x}.
948  @end deffn  @end deffn
949    
950  @c begin (texi-doc-string "guile" "$tanh")  @c begin (texi-doc-string "guile" "$tanh")
951  @deffn primitive $tanh x  @deffn {Scheme Procedure} $tanh x
952  Return the hyperbolic tangent of @var{x}.  Return the hyperbolic tangent of @var{x}.
953  @end deffn  @end deffn
954    
955  @c begin (texi-doc-string "guile" "$asinh")  @c begin (texi-doc-string "guile" "$asinh")
956  @deffn primitive $asinh x  @deffn {Scheme Procedure} $asinh x
957  Return the hyperbolic arcsine of @var{x}.  Return the hyperbolic arcsine of @var{x}.
958  @end deffn  @end deffn
959    
960  @c begin (texi-doc-string "guile" "$acosh")  @c begin (texi-doc-string "guile" "$acosh")
961  @deffn primitive $acosh x  @deffn {Scheme Procedure} $acosh x
962  Return the hyperbolic arccosine of @var{x}.  Return the hyperbolic arccosine of @var{x}.
963  @end deffn  @end deffn
964    
965  @c begin (texi-doc-string "guile" "$atanh")  @c begin (texi-doc-string "guile" "$atanh")
966  @deffn primitive $atanh x  @deffn {Scheme Procedure} $atanh x
967  Return the hyperbolic arctangent of @var{x}.  Return the hyperbolic arctangent of @var{x}.
968  @end deffn  @end deffn
969    
# Line 955  Return the hyperbolic arctangent of @var Line 971  Return the hyperbolic arctangent of @var
971  @node Bitwise Operations  @node Bitwise Operations
972  @subsection Bitwise Operations  @subsection Bitwise Operations
973    
974  @deffn primitive logand n1 n2  @deffn {Scheme Procedure} logand n1 n2
975  Return the bitwise AND of the integer arguments.  Return the bitwise AND of the integer arguments.
976    
977  @lisp  @lisp
# Line 965  Return the bitwise AND of the integer ar Line 981  Return the bitwise AND of the integer ar
981  @end lisp  @end lisp
982  @end deffn  @end deffn
983    
984  @deffn primitive logior n1 n2  @deffn {Scheme Procedure} logior n1 n2
985  Return the bitwise OR of the integer arguments.  Return the bitwise OR of the integer arguments.
986    
987  @lisp  @lisp
# Line 975  Return the bitwise OR of the integer arg Line 991  Return the bitwise OR of the integer arg
991  @end lisp  @end lisp
992  @end deffn  @end deffn
993    
994  @deffn primitive logxor n1 n2  @deffn {Scheme Procedure} logxor n1 n2
995  Return the bitwise XOR of the integer arguments.  A bit is  Return the bitwise XOR of the integer arguments.  A bit is
996  set in the result if it is set in an odd number of arguments.  set in the result if it is set in an odd number of arguments.
997  @lisp  @lisp
# Line 986  set in the result if it is set in an odd Line 1002  set in the result if it is set in an odd
1002  @end lisp  @end lisp
1003  @end deffn  @end deffn
1004    
1005  @deffn primitive lognot n  @deffn {Scheme Procedure} lognot n
1006    @deffnx {C Function} scm_lognot (n)
1007  Return the integer which is the 2s-complement of the integer  Return the integer which is the 2s-complement of the integer
1008  argument.  argument.
1009    
# Line 998  argument. Line 1015  argument.
1015  @end lisp  @end lisp
1016  @end deffn  @end deffn
1017    
1018  @deffn primitive logtest j k  @deffn {Scheme Procedure} logtest j k
1019    @deffnx {C Function} scm_logtest (j, k)
1020  @lisp  @lisp
1021  (logtest j k) @equiv{} (not (zero? (logand j k)))  (logtest j k) @equiv{} (not (zero? (logand j k)))
1022    
# Line 1007  argument. Line 1025  argument.
1025  @end lisp  @end lisp
1026  @end deffn  @end deffn
1027    
1028  @deffn primitive logbit? index j  @deffn {Scheme Procedure} logbit? index j
1029    @deffnx {C Function} scm_logbit_p (index, j)
1030  @lisp  @lisp
1031  (logbit? index j) @equiv{} (logtest (integer-expt 2 index) j)  (logbit? index j) @equiv{} (logtest (integer-expt 2 index) j)
1032    
# Line 1019  argument. Line 1038  argument.
1038  @end lisp  @end lisp
1039  @end deffn  @end deffn
1040    
1041  @deffn primitive ash n cnt  @deffn {Scheme Procedure} ash n cnt
1042    @deffnx {C Function} scm_ash (n, cnt)
1043  The function ash performs an arithmetic shift left by @var{cnt}  The function ash performs an arithmetic shift left by @var{cnt}
1044  bits (or shift right, if @var{cnt} is negative).  'Arithmetic'  bits (or shift right, if @var{cnt} is negative).  'Arithmetic'
1045  means, that the function does not guarantee to keep the bit  means, that the function does not guarantee to keep the bit
# Line 1037  Formally, the function returns an intege Line 1057  Formally, the function returns an intege
1057  @end lisp  @end lisp
1058  @end deffn  @end deffn
1059    
1060  @deffn primitive logcount n  @deffn {Scheme Procedure} logcount n
1061    @deffnx {C Function} scm_logcount (n)
1062  Return the number of bits in integer @var{n}.  If integer is  Return the number of bits in integer @var{n}.  If integer is
1063  positive, the 1-bits in its binary representation are counted.  positive, the 1-bits in its binary representation are counted.
1064  If negative, the 0-bits in its two's-complement binary  If negative, the 0-bits in its two's-complement binary
# Line 1053  representation are counted.  If 0, 0 is Line 1074  representation are counted.  If 0, 0 is
1074  @end lisp  @end lisp
1075  @end deffn  @end deffn
1076    
1077  @deffn primitive integer-length n  @deffn {Scheme Procedure} integer-length n
1078    @deffnx {C Function} scm_integer_length (n)
1079  Return the number of bits necessary to represent @var{n}.  Return the number of bits necessary to represent @var{n}.
1080    
1081  @lisp  @lisp
# Line 1066  Return the number of bits necessary to r Line 1088  Return the number of bits necessary to r
1088  @end lisp  @end lisp
1089  @end deffn  @end deffn
1090    
1091  @deffn primitive integer-expt n k  @deffn {Scheme Procedure} integer-expt n k
1092    @deffnx {C Function} scm_integer_expt (n, k)
1093  Return @var{n} raised to the non-negative integer exponent  Return @var{n} raised to the non-negative integer exponent
1094  @var{k}.  @var{k}.
1095    
# Line 1078  Return @var{n} raised to the non-negativ Line 1101  Return @var{n} raised to the non-negativ
1101  @end lisp  @end lisp
1102  @end deffn  @end deffn
1103    
1104  @deffn primitive bit-extract n start end  @deffn {Scheme Procedure} bit-extract n start end
1105    @deffnx {C Function} scm_bit_extract (n, start, end)
1106  Return the integer composed of the @var{start} (inclusive)  Return the integer composed of the @var{start} (inclusive)
1107  through @var{end} (exclusive) bits of @var{n}.  The  through @var{end} (exclusive) bits of @var{n}.  The
1108  @var{start}th bit becomes the 0-th bit in the result.  @var{start}th bit becomes the 0-th bit in the result.
# Line 1095  through @var{end} (exclusive) bits of @v Line 1119  through @var{end} (exclusive) bits of @v
1119  @node Random  @node Random
1120  @subsection Random Number Generation  @subsection Random Number Generation
1121    
1122  @deffn primitive copy-random-state [state]  @deffn {Scheme Procedure} copy-random-state [state]
1123    @deffnx {C Function} scm_copy_random_state (state)
1124  Return a copy of the random state @var{state}.  Return a copy of the random state @var{state}.
1125  @end deffn  @end deffn
1126    
1127  @deffn primitive random n [state]  @deffn {Scheme Procedure} random n [state]
1128    @deffnx {C Function} scm_random (n, state)
1129  Return a number in [0,N).  Return a number in [0,N).
1130    
1131  Accepts a positive integer or real n and returns a  Accepts a positive integer or real n and returns a
# Line 1114  the state of the pseudo-random-number ge Line 1140  the state of the pseudo-random-number ge
1140  as a side effect of the random operation.  as a side effect of the random operation.
1141  @end deffn  @end deffn
1142    
1143  @deffn primitive random:exp [state]  @deffn {Scheme Procedure} random:exp [state]
1144    @deffnx {C Function} scm_random_exp (state)
1145  Return an inexact real in an exponential distribution with mean  Return an inexact real in an exponential distribution with mean
1146  1.  For an exponential distribution with mean u use (* u  1.  For an exponential distribution with mean u use (* u
1147  (random:exp)).  (random:exp)).
1148  @end deffn  @end deffn
1149    
1150  @deffn primitive random:hollow-sphere! v [state]  @deffn {Scheme Procedure} random:hollow-sphere! v [state]
1151    @deffnx {C Function} scm_random_hollow_sphere_x (v, state)
1152  Fills vect with inexact real random numbers  Fills vect with inexact real random numbers
1153  the sum of whose squares is equal to 1.0.  the sum of whose squares is equal to 1.0.
1154  Thinking of vect as coordinates in space of  Thinking of vect as coordinates in space of
# Line 1129  are uniformly distributed over the surfa Line 1157  are uniformly distributed over the surfa
1157  unit n-sphere.  unit n-sphere.
1158  @end deffn  @end deffn
1159    
1160  @deffn primitive random:normal [state]  @deffn {Scheme Procedure} random:normal [state]
1161    @deffnx {C Function} scm_random_normal (state)
1162  Return an inexact real in a normal distribution.  The  Return an inexact real in a normal distribution.  The
1163  distribution used has mean 0 and standard deviation 1.  For a  distribution used has mean 0 and standard deviation 1.  For a
1164  normal distribution with mean m and standard deviation d use  normal distribution with mean m and standard deviation d use
1165  @code{(+ m (* d (random:normal)))}.  @code{(+ m (* d (random:normal)))}.
1166  @end deffn  @end deffn
1167    
1168  @deffn primitive random:normal-vector! v [state]  @deffn {Scheme Procedure} random:normal-vector! v [state]
1169    @deffnx {C Function} scm_random_normal_vector_x (v, state)
1170  Fills vect with inexact real random numbers that are  Fills vect with inexact real random numbers that are
1171  independent and standard normally distributed  independent and standard normally distributed
1172  (i.e., with mean 0 and variance 1).  (i.e., with mean 0 and variance 1).
1173  @end deffn  @end deffn
1174    
1175  @deffn primitive random:solid-sphere! v [state]  @deffn {Scheme Procedure} random:solid-sphere! v [state]
1176    @deffnx {C Function} scm_random_solid_sphere_x (v, state)
1177  Fills vect with inexact real random numbers  Fills vect with inexact real random numbers
1178  the sum of whose squares is less than 1.0.  the sum of whose squares is less than 1.0.
1179  Thinking of vect as coordinates in space of  Thinking of vect as coordinates in space of
# Line 1151  are uniformly distributed within the uni Line 1182  are uniformly distributed within the uni
1182  The sum of the squares of the numbers is returned.  The sum of the squares of the numbers is returned.
1183  @end deffn  @end deffn
1184    
1185  @deffn primitive random:uniform [state]  @deffn {Scheme Procedure} random:uniform [state]
1186    @deffnx {C Function} scm_random_uniform (state)
1187  Return a uniformly distributed inexact real random number in  Return a uniformly distributed inexact real random number in
1188  [0,1).  [0,1).
1189  @end deffn  @end deffn
1190    
1191  @deffn primitive seed->random-state seed  @deffn {Scheme Procedure} seed->random-state seed
1192    @deffnx {C Function} scm_seed_to_random_state (seed)
1193  Return a new random state using @var{seed}.  Return a new random state using @var{seed}.
1194  @end deffn  @end deffn
1195    
# Line 1228  Several characters have more than one na Line 1261  Several characters have more than one na
1261  @end itemize  @end itemize
1262    
1263  @rnindex char?  @rnindex char?
1264  @deffn primitive char? x  @deffn {Scheme Procedure} char? x
1265    @deffnx {C Function} scm_char_p (x)
1266  Return @code{#t} iff @var{x} is a character, else @code{#f}.  Return @code{#t} iff @var{x} is a character, else @code{#f}.
1267  @end deffn  @end deffn
1268    
1269  @rnindex char=?  @rnindex char=?
1270  @deffn primitive char=? x y  @deffn {Scheme Procedure} char=? x y
1271  Return @code{#t} iff @var{x} is the same character as @var{y}, else @code{#f}.  Return @code{#t} iff @var{x} is the same character as @var{y}, else @code{#f}.
1272  @end deffn  @end deffn
1273    
1274  @rnindex char<?  @rnindex char<?
1275  @deffn primitive char<? x y  @deffn {Scheme Procedure} char<? x y
1276  Return @code{#t} iff @var{x} is less than @var{y} in the ASCII sequence,  Return @code{#t} iff @var{x} is less than @var{y} in the ASCII sequence,
1277  else @code{#f}.  else @code{#f}.
1278  @end deffn  @end deffn
1279    
1280  @rnindex char<=?  @rnindex char<=?
1281  @deffn primitive char<=? x y  @deffn {Scheme Procedure} char<=? x y
1282  Return @code{#t} iff @var{x} is less than or equal to @var{y} in the  Return @code{#t} iff @var{x} is less than or equal to @var{y} in the
1283  ASCII sequence, else @code{#f}.  ASCII sequence, else @code{#f}.
1284  @end deffn  @end deffn
1285    
1286  @rnindex char>?  @rnindex char>?
1287  @deffn primitive char>? x y  @deffn {Scheme Procedure} char>? x y
1288  Return @code{#t} iff @var{x} is greater than @var{y} in the ASCII  Return @code{#t} iff @var{x} is greater than @var{y} in the ASCII
1289  sequence, else @code{#f}.  sequence, else @code{#f}.
1290  @end deffn  @end deffn
1291    
1292  @rnindex char>=?  @rnindex char>=?
1293  @deffn primitive char>=? x y  @deffn {Scheme Procedure} char>=? x y
1294  Return @code{#t} iff @var{x} is greater than or equal to @var{y} in the  Return @code{#t} iff @var{x} is greater than or equal to @var{y} in the
1295  ASCII sequence, else @code{#f}.  ASCII sequence, else @code{#f}.
1296  @end deffn  @end deffn
1297    
1298  @rnindex char-ci=?  @rnindex char-ci=?
1299  @deffn primitive char-ci=? x y  @deffn {Scheme Procedure} char-ci=? x y
1300  Return @code{#t} iff @var{x} is the same character as @var{y} ignoring  Return @code{#t} iff @var{x} is the same character as @var{y} ignoring
1301  case, else @code{#f}.  case, else @code{#f}.
1302  @end deffn  @end deffn
1303    
1304  @rnindex char-ci<?  @rnindex char-ci<?
1305  @deffn primitive char-ci<? x y  @deffn {Scheme Procedure} char-ci<? x y
1306  Return @code{#t} iff @var{x} is less than @var{y} in the ASCII sequence  Return @code{#t} iff @var{x} is less than @var{y} in the ASCII sequence
1307  ignoring case, else @code{#f}.  ignoring case, else @code{#f}.
1308  @end deffn  @end deffn
1309    
1310  @rnindex char-ci<=?  @rnindex char-ci<=?
1311  @deffn primitive char-ci<=? x y  @deffn {Scheme Procedure} char-ci<=? x y
1312  Return @code{#t} iff @var{x} is less than or equal to @var{y} in the  Return @code{#t} iff @var{x} is less than or equal to @var{y} in the
1313  ASCII sequence ignoring case, else @code{#f}.  ASCII sequence ignoring case, else @code{#f}.
1314  @end deffn  @end deffn
1315    
1316  @rnindex char-ci>?  @rnindex char-ci>?
1317  @deffn primitive char-ci>? x y  @deffn {Scheme Procedure} char-ci>? x y
1318  Return @code{#t} iff @var{x} is greater than @var{y} in the ASCII  Return @code{#t} iff @var{x} is greater than @var{y} in the ASCII
1319  sequence ignoring case, else @code{#f}.  sequence ignoring case, else @code{#f}.
1320  @end deffn  @end deffn
1321    
1322  @rnindex char-ci>=?  @rnindex char-ci>=?
1323  @deffn primitive char-ci>=? x y  @deffn {Scheme Procedure} char-ci>=? x y
1324  Return @code{#t} iff @var{x} is greater than or equal to @var{y} in the  Return @code{#t} iff @var{x} is greater than or equal to @var{y} in the
1325  ASCII sequence ignoring case, else @code{#f}.  ASCII sequence ignoring case, else @code{#f}.
1326  @end deffn  @end deffn
1327    
1328  @rnindex char-alphabetic?  @rnindex char-alphabetic?
1329  @deffn primitive char-alphabetic? chr  @deffn {Scheme Procedure} char-alphabetic? chr
1330    @deffnx {C Function} scm_char_alphabetic_p (chr)
1331  Return @code{#t} iff @var{chr} is alphabetic, else @code{#f}.  Return @code{#t} iff @var{chr} is alphabetic, else @code{#f}.
1332  Alphabetic means the same thing as the isalpha C library function.  Alphabetic means the same thing as the isalpha C library function.
1333  @end deffn  @end deffn
1334    
1335  @rnindex char-numeric?  @rnindex char-numeric?
1336  @deffn primitive char-numeric? chr  @deffn {Scheme Procedure} char-numeric? chr
1337    @deffnx {C Function} scm_char_numeric_p (chr)
1338  Return @code{#t} iff @var{chr} is numeric, else @code{#f}.  Return @code{#t} iff @var{chr} is numeric, else @code{#f}.
1339  Numeric means the same thing as the isdigit C library function.  Numeric means the same thing as the isdigit C library function.
1340  @end deffn  @end deffn
1341    
1342  @rnindex char-whitespace?  @rnindex char-whitespace?
1343  @deffn primitive char-whitespace? chr  @deffn {Scheme Procedure} char-whitespace? chr
1344    @deffnx {C Function} scm_char_whitespace_p (chr)
1345  Return @code{#t} iff @var{chr} is whitespace, else @code{#f}.  Return @code{#t} iff @var{chr} is whitespace, else @code{#f}.
1346  Whitespace means the same thing as the isspace C library function.  Whitespace means the same thing as the isspace C library function.
1347  @end deffn  @end deffn
1348    
1349  @rnindex char-upper-case?  @rnindex char-upper-case?
1350  @deffn primitive char-upper-case? chr  @deffn {Scheme Procedure} char-upper-case? chr
1351    @deffnx {C Function} scm_char_upper_case_p (chr)
1352  Return @code{#t} iff @var{chr} is uppercase, else @code{#f}.  Return @code{#t} iff @var{chr} is uppercase, else @code{#f}.
1353  Uppercase means the same thing as the isupper C library function.  Uppercase means the same thing as the isupper C library function.
1354  @end deffn  @end deffn
1355    
1356  @rnindex char-lower-case?  @rnindex char-lower-case?
1357  @deffn primitive char-lower-case? chr  @deffn {Scheme Procedure} char-lower-case? chr
1358    @deffnx {C Function} scm_char_lower_case_p (chr)
1359  Return @code{#t} iff @var{chr} is lowercase, else @code{#f}.  Return @code{#t} iff @var{chr} is lowercase, else @code{#f}.
1360  Lowercase means the same thing as the islower C library function.  Lowercase means the same thing as the islower C library function.
1361  @end deffn  @end deffn
1362    
1363  @deffn primitive char-is-both? chr  @deffn {Scheme Procedure} char-is-both? chr
1364    @deffnx {C Function} scm_char_is_both_p (chr)
1365  Return @code{#t} iff @var{chr} is either uppercase or lowercase, else @code{#f}.  Return @code{#t} iff @var{chr} is either uppercase or lowercase, else @code{#f}.
1366  Uppercase and lowercase are as defined by the isupper and islower  Uppercase and lowercase are as defined by the isupper and islower
1367  C library functions.  C library functions.
1368  @end deffn  @end deffn
1369    
1370  @rnindex char->integer  @rnindex char->integer
1371  @deffn primitive char->integer chr  @deffn {Scheme Procedure} char->integer chr
1372    @deffnx {C Function} scm_char_to_integer (chr)
1373  Return the number corresponding to ordinal position of @var{chr} in the  Return the number corresponding to ordinal position of @var{chr} in the
1374  ASCII sequence.  ASCII sequence.
1375  @end deffn  @end deffn
1376    
1377  @rnindex integer->char  @rnindex integer->char
1378  @deffn primitive integer->char n  @deffn {Scheme Procedure} integer->char n
1379    @deffnx {C Function} scm_integer_to_char (n)
1380  Return the character at position @var{n} in the ASCII sequence.  Return the character at position @var{n} in the ASCII sequence.
1381  @end deffn  @end deffn
1382    
1383  @rnindex char-upcase  @rnindex char-upcase
1384  @deffn primitive char-upcase chr  @deffn {Scheme Procedure} char-upcase chr
1385    @deffnx {C Function} scm_char_upcase (chr)
1386  Return the uppercase character version of @var{chr}.  Return the uppercase character version of @var{chr}.
1387  @end deffn  @end deffn
1388    
1389  @rnindex char-downcase  @rnindex char-downcase
1390  @deffn primitive char-downcase chr  @deffn {Scheme Procedure} char-downcase chr
1391    @deffnx {C Function} scm_char_downcase (chr)
1392  Return the lowercase character version of @var{chr}.  Return the lowercase character version of @var{chr}.
1393  @end deffn  @end deffn
1394    
# Line 1410  The following procedures can be used to Line 1454  The following procedures can be used to
1454  fulfills some specified property.  fulfills some specified property.
1455    
1456  @rnindex string?  @rnindex string?
1457  @deffn primitive string? obj  @deffn {Scheme Procedure} string? obj
1458  Return @code{#t} iff @var{obj} is a string, else @code{#f}.  @deffnx {C Function} scm_string_p (obj)
1459    Return @code{#t} if @var{obj} is a string, else @code{#f}.
1460  @end deffn  @end deffn
1461    
1462  @deffn primitive string-null? str  @deffn {Scheme Procedure} string-null? str
1463    @deffnx {C Function} scm_string_null_p (str)
1464  Return @code{#t} if @var{str}'s length is zero, and  Return @code{#t} if @var{str}'s length is zero, and
1465  @code{#f} otherwise.  @code{#f} otherwise.
1466  @lisp  @lisp
# Line 1434  initializing them with some specified ch Line 1480  initializing them with some specified ch
1480    
1481  @rnindex string  @rnindex string
1482  @rnindex list->string  @rnindex list->string
1483  @deffn primitive string . chrs  @deffn {Scheme Procedure} string . chrs
1484  @deffnx primitive list->string chrs  @deffnx {Scheme Procedure} list->string chrs
1485    @deffnx {C Function} scm_string (chrs)
1486  Return a newly allocated string composed of the arguments,  Return a newly allocated string composed of the arguments,
1487  @var{chrs}.  @var{chrs}.
1488  @end deffn  @end deffn
1489    
1490  @rnindex make-string  @rnindex make-string
1491  @deffn primitive make-string k [chr]  @deffn {Scheme Procedure} make-string k [chr]
1492    @deffnx {C Function} scm_make_string (k, chr)
1493  Return a newly allocated string of  Return a newly allocated string of
1494  length @var{k}.  If @var{chr} is given, then all elements of  length @var{k}.  If @var{chr} is given, then all elements of
1495  the string are initialized to @var{chr}, otherwise the contents  the string are initialized to @var{chr}, otherwise the contents
# Line 1457  work with the resulting list, and then c Line 1505  work with the resulting list, and then c
1505  These procedures are useful for similar tasks.  These procedures are useful for similar tasks.
1506    
1507  @rnindex string->list  @rnindex string->list
1508  @deffn primitive string->list str  @deffn {Scheme Procedure} string->list str
1509    @deffnx {C Function} scm_string_to_list (str)
1510  Return a newly allocated list of the characters that make up  Return a newly allocated list of the characters that make up
1511  the given string @var{str}. @code{string->list} and  the given string @var{str}. @code{string->list} and
1512  @code{list->string} are inverses as far as @samp{equal?} is  @code{list->string} are inverses as far as @samp{equal?} is
1513  concerned.  concerned.
1514  @end deffn  @end deffn
1515    
1516  @deffn primitive string-split str chr  @deffn {Scheme Procedure} string-split str chr
1517    @deffnx {C Function} scm_string_split (str, chr)
1518  Split the string @var{str} into the a list of the substrings delimited  Split the string @var{str} into the a list of the substrings delimited
1519  by appearances of the character @var{chr}.  Note that an empty substring  by appearances of the character @var{chr}.  Note that an empty substring
1520  between separator characters will result in an empty string in the  between separator characters will result in an empty string in the
1521  result list.  result list.
1522    
1523  @lisp  @lisp
1524  (string-split "root:x:0:0:root:/root:/bin/bash" #\:)  (string-split "root:x:0:0:root:/root:/bin/bash" #\:)
1525  @result{}  @result{}
# Line 1493  Portions of strings can be extracted by Line 1544  Portions of strings can be extracted by
1544  @code{substring} can be used to extract substrings from longer strings.  @code{substring} can be used to extract substrings from longer strings.
1545    
1546  @rnindex string-length  @rnindex string-length
1547  @deffn primitive string-length string  @deffn {Scheme Procedure} string-length string
1548    @deffnx {C Function} scm_string_length (string)
1549  Return the number of characters in @var{string}.  Return the number of characters in @var{string}.
1550  @end deffn  @end deffn
1551    
1552  @rnindex string-ref  @rnindex string-ref
1553  @deffn primitive string-ref str k  @deffn {Scheme Procedure} string-ref str k
1554    @deffnx {C Function} scm_string_ref (str, k)
1555  Return character @var{k} of @var{str} using zero-origin  Return character @var{k} of @var{str} using zero-origin
1556  indexing. @var{k} must be a valid index of @var{str}.  indexing. @var{k} must be a valid index of @var{str}.
1557  @end deffn  @end deffn
1558    
1559  @rnindex string-copy  @rnindex string-copy
1560  @deffn primitive string-copy str  @deffn {Scheme Procedure} string-copy str
1561    @deffnx {C Function} scm_string_copy (str)
1562  Return a newly allocated copy of the given @var{string}.  Return a newly allocated copy of the given @var{string}.
1563  @end deffn  @end deffn
1564    
1565  @rnindex substring  @rnindex substring
1566  @deffn primitive substring str start [end]  @deffn {Scheme Procedure} substring str start [end]
1567    @deffnx {C Function} scm_substring (str, start, end)
1568  Return a newly allocated string formed from the characters  Return a newly allocated string formed from the characters
1569  of @var{str} beginning with index @var{start} (inclusive) and  of @var{str} beginning with index @var{start} (inclusive) and
1570  ending with index @var{end} (exclusive).  ending with index @var{end} (exclusive).
# Line 1527  result of the operation is not a new str Line 1582  result of the operation is not a new str
1582  memory representation is modified.  memory representation is modified.
1583    
1584  @rnindex string-set!  @rnindex string-set!
1585  @deffn primitive string-set! str k chr  @deffn {Scheme Procedure} string-set! str k chr
1586    @deffnx {C Function} scm_string_set_x (str, k, chr)
1587  Store @var{chr} in element @var{k} of @var{str} and return  Store @var{chr} in element @var{k} of @var{str} and return
1588  an unspecified value. @var{k} must be a valid index of  an unspecified value. @var{k} must be a valid index of
1589  @var{str}.  @var{str}.
1590  @end deffn  @end deffn
1591    
1592  @rnindex string-fill!  @rnindex string-fill!
1593  @deffn primitive string-fill! str chr  @deffn {Scheme Procedure} string-fill! str chr
1594    @deffnx {C Function} scm_string_fill_x (str, chr)
1595  Store @var{char} in every element of the given @var{string} and  Store @var{char} in every element of the given @var{string} and
1596  return an unspecified value.  return an unspecified value.
1597  @end deffn  @end deffn
1598    
1599  @deffn primitive substring-fill! str start end fill  @deffn {Scheme Procedure} substring-fill! str start end fill
1600    @deffnx {C Function} scm_substring_fill_x (str, start, end, fill)
1601  Change every character in @var{str} between @var{start} and  Change every character in @var{str} between @var{start} and
1602  @var{end} to @var{fill}.  @var{end} to @var{fill}.
1603    
# Line 1551  y Line 1609  y
1609  @end lisp  @end lisp
1610  @end deffn  @end deffn
1611    
1612  @deffn primitive substring-move! str1 start1 end1 str2 start2  @deffn {Scheme Procedure} substring-move! str1 start1 end1 str2 start2
1613    @deffnx {C Function} scm_substring_move_x (str1, start1, end1, str2, start2)
1614  Copy the substring of @var{str1} bounded by @var{start1} and @var{end1}  Copy the substring of @var{str1} bounded by @var{start1} and @var{end1}
1615  into @var{str2} beginning at position @var{start2}.  into @var{str2} beginning at position @var{start2}.
1616  @var{str1} and @var{str2} can be the same string.  @var{str1} and @var{str2} can be the same string.
# Line 1569  strings. Line 1628  strings.
1628    
1629    
1630  @rnindex string=?  @rnindex string=?
1631  @deffn primitive string=? s1 s2  @deffn {Scheme Procedure} string=? s1 s2
1632  Lexicographic equality predicate; return @code{#t} if the two  Lexicographic equality predicate; return @code{#t} if the two
1633  strings are the same length and contain the same characters in  strings are the same length and contain the same characters in
1634  the same positions, otherwise return @code{#f}.  the same positions, otherwise return @code{#f}.
# Line 1581  characters. Line 1640  characters.
1640  @end deffn  @end deffn
1641    
1642  @rnindex string<?  @rnindex string<?
1643  @deffn primitive string<? s1 s2  @deffn {Scheme Procedure} string<? s1 s2
1644  Lexicographic ordering predicate; return @code{#t} if @var{s1}  Lexicographic ordering predicate; return @code{#t} if @var{s1}
1645  is lexicographically less than @var{s2}.  is lexicographically less than @var{s2}.
1646  @end deffn  @end deffn
1647    
1648  @rnindex string<=?  @rnindex string<=?
1649  @deffn primitive string<=? s1 s2  @deffn {Scheme Procedure} string<=? s1 s2
1650  Lexicographic ordering predicate; return @code{#t} if @var{s1}  Lexicographic ordering predicate; return @code{#t} if @var{s1}
1651  is lexicographically less than or equal to @var{s2}.  is lexicographically less than or equal to @var{s2}.
1652  @end deffn  @end deffn
1653    
1654  @rnindex string>?  @rnindex string>?
1655  @deffn primitive string>? s1 s2  @deffn {Scheme Procedure} string>? s1 s2
1656  Lexicographic ordering predicate; return @code{#t} if @var{s1}  Lexicographic ordering predicate; return @code{#t} if @var{s1}
1657  is lexicographically greater than @var{s2}.  is lexicographically greater than @var{s2}.
1658  @end deffn  @end deffn
1659    
1660  @rnindex string>=?  @rnindex string>=?
1661  @deffn primitive string>=? s1 s2  @deffn {Scheme Procedure} string>=? s1 s2
1662  Lexicographic ordering predicate; return @code{#t} if @var{s1}  Lexicographic ordering predicate; return @code{#t} if @var{s1}
1663  is lexicographically greater than or equal to @var{s2}.  is lexicographically greater than or equal to @var{s2}.
1664  @end deffn  @end deffn
1665    
1666  @rnindex string-ci=?  @rnindex string-ci=?
1667  @deffn primitive string-ci=? s1 s2  @deffn {Scheme Procedure} string-ci=? s1 s2
1668  Case-insensitive string equality predicate; return @code{#t} if  Case-insensitive string equality predicate; return @code{#t} if
1669  the two strings are the same length and their component  the two strings are the same length and their component
1670  characters match (ignoring case) at each position; otherwise  characters match (ignoring case) at each position; otherwise
# Line 1613  return @code{#f}. Line 1672  return @code{#f}.
1672  @end deffn  @end deffn
1673    
1674  @rnindex string-ci<  @rnindex string-ci<
1675  @deffn primitive string-ci<? s1 s2  @deffn {Scheme Procedure} string-ci<? s1 s2
1676  Case insensitive lexicographic ordering predicate; return  Case insensitive lexicographic ordering predicate; return
1677  @code{#t} if @var{s1} is lexicographically less than @var{s2}  @code{#t} if @var{s1} is lexicographically less than @var{s2}
1678  regardless of case.  regardless of case.
1679  @end deffn  @end deffn
1680    
1681  @rnindex string<=?  @rnindex string<=?
1682  @deffn primitive string-ci<=? s1 s2  @deffn {Scheme Procedure} string-ci<=? s1 s2
1683  Case insensitive lexicographic ordering predicate; return  Case insensitive lexicographic ordering predicate; return
1684  @code{#t} if @var{s1} is lexicographically less than or equal  @code{#t} if @var{s1} is lexicographically less than or equal
1685  to @var{s2} regardless of case.  to @var{s2} regardless of case.
1686  @end deffn  @end deffn
1687    
1688  @rnindex string-ci>?  @rnindex string-ci>?
1689  @deffn primitive string-ci>? s1 s2  @deffn {Scheme Procedure} string-ci>? s1 s2
1690  Case insensitive lexicographic ordering predicate; return  Case insensitive lexicographic ordering predicate; return
1691  @code{#t} if @var{s1} is lexicographically greater than  @code{#t} if @var{s1} is lexicographically greater than
1692  @var{s2} regardless of case.  @var{s2} regardless of case.
1693  @end deffn  @end deffn
1694    
1695  @rnindex string-ci>=?  @rnindex string-ci>=?
1696  @deffn primitive string-ci>=? s1 s2  @deffn {Scheme Procedure} string-ci>=? s1 s2
1697  Case insensitive lexicographic ordering predicate; return  Case insensitive lexicographic ordering predicate; return
1698  @code{#t} if @var{s1} is lexicographically greater than or  @code{#t} if @var{s1} is lexicographically greater than or
1699  equal to @var{s2} regardless of case.  equal to @var{s2} regardless of case.
# Line 1647  equal to @var{s2} regardless of case. Line 1706  equal to @var{s2} regardless of case.
1706  When searching for the index of a character in a string, these  When searching for the index of a character in a string, these
1707  procedures can be used.  procedures can be used.
1708    
1709  @deffn primitive string-index str chr [frm [to]]  @deffn {Scheme Procedure} string-index str chr [frm [to]]
1710    @deffnx {C Function} scm_string_index (str, chr, frm, to)
1711  Return the index of the first occurrence of @var{chr} in  Return the index of the first occurrence of @var{chr} in
1712  @var{str}.  The optional integer arguments @var{frm} and  @var{str}.  The optional integer arguments @var{frm} and
1713  @var{to} limit the search to a portion of the string.  This  @var{to} limit the search to a portion of the string.  This
# Line 1666  procedure essentially implements the @co Line 1726  procedure essentially implements the @co
1726  @end lisp  @end lisp
1727  @end deffn  @end deffn
1728    
1729  @deffn primitive string-rindex str chr [frm [to]]  @deffn {Scheme Procedure} string-rindex str chr [frm [to]]
1730    @deffnx {C Function} scm_string_rindex (str, chr, frm, to)
1731  Like @code{string-index}, but search from the right of the  Like @code{string-index}, but search from the right of the
1732  string rather than from the left.  This procedure essentially  string rather than from the left.  This procedure essentially
1733  implements the @code{rindex} or @code{strrchr} functions from  implements the @code{rindex} or @code{strrchr} functions from
# Line 1690  the C library. Line 1751  the C library.
1751  These are procedures for mapping strings to their upper- or lower-case  These are procedures for mapping strings to their upper- or lower-case
1752  equivalents, respectively, or for capitalizing strings.  equivalents, respectively, or for capitalizing strings.
1753    
1754  @deffn primitive string-upcase str  @deffn {Scheme Procedure} string-upcase str
1755    @deffnx {C Function} scm_string_upcase (str)
1756  Return a freshly allocated string containing the characters of  Return a freshly allocated string containing the characters of
1757  @var{str} in upper case.  @var{str} in upper case.
1758  @end deffn  @end deffn
1759    
1760  @deffn primitive string-upcase! str  @deffn {Scheme Procedure} string-upcase! str
1761    @deffnx {C Function} scm_string_upcase_x (str)
1762  Destructively upcase every character in @var{str} and return  Destructively upcase every character in @var{str} and return
1763  @var{str}.  @var{str}.
1764  @lisp  @lisp
# Line 1705  y                  @result{} "ARRDEFG" Line 1768  y                  @result{} "ARRDEFG"
1768  @end lisp  @end lisp
1769  @end deffn  @end deffn
1770    
1771  @deffn primitive string-downcase str  @deffn {Scheme Procedure} string-downcase str
1772    @deffnx {C Function} scm_string_downcase (str)
1773  Return a freshly allocation string containing the characters in  Return a freshly allocation string containing the characters in
1774  @var{str} in lower case.  @var{str} in lower case.
1775  @end deffn  @end deffn
1776    
1777  @deffn primitive string-downcase! str  @deffn {Scheme Procedure} string-downcase! str
1778    @deffnx {C Function} scm_string_downcase_x (str)
1779  Destructively downcase every character in @var{str} and return  Destructively downcase every character in @var{str} and return
1780  @var{str}.  @var{str}.
1781  @lisp  @lisp
# Line 1720  y                     @result{} "arrdefg Line 1785  y                     @result{} "arrdefg
1785  @end lisp  @end lisp
1786  @end deffn  @end deffn
1787    
1788  @deffn primitive string-capitalize str  @deffn {Scheme Procedure} string-capitalize str
1789    @deffnx {C Function} scm_string_capitalize (str)
1790  Return a freshly allocated string with the characters in  Return a freshly allocated string with the characters in
1791  @var{str}, where the first character of every word is  @var{str}, where the first character of every word is
1792  capitalized.  capitalized.
1793  @end deffn  @end deffn
1794    
1795  @deffn primitive string-capitalize! str  @deffn {Scheme Procedure} string-capitalize! str
1796    @deffnx {C Function} scm_string_capitalize_x (str)
1797  Upcase the first character of every word in @var{str}  Upcase the first character of every word in @var{str}
1798  destructively and return @var{str}.  destructively and return @var{str}.
1799    
# Line 1745  The procedure @code{string-append} appen Line 1812  The procedure @code{string-append} appen
1812  form a longer result string.  form a longer result string.
1813    
1814  @rnindex string-append  @rnindex string-append
1815  @deffn primitive string-append  string1 @dots{}  @deffn {Scheme Procedure} string-append . args
1816    @deffnx {C Function} scm_string_append (args)
1817  Return a newly allocated string whose characters form the  Return a newly allocated string whose characters form the
1818  concatenation of the given strings.  concatenation of the given strings, @var{args}.
1819  @end deffn  @end deffn
1820    
1821    
# Line 1756  concatenation of the given strings. Line 1824  concatenation of the given strings.
1824    
1825  This section contains all remaining string procedures.  This section contains all remaining string procedures.
1826    
1827  @deffn primitive string-ci->symbol str  @deffn {Scheme Procedure} string-ci->symbol str
1828    @deffnx {C Function} scm_string_ci_to_symbol (str)
1829  Return the symbol whose name is @var{str}.  @var{str} is  Return the symbol whose name is @var{str}.  @var{str} is
1830  converted to lowercase before the conversion is done, if Guile  converted to lowercase before the conversion is done, if Guile
1831  is currently reading symbols case-insensitively.  is currently reading symbols case-insensitively.
# Line 1808  implemented by SCSH, the Scheme Shell. Line 1877  implemented by SCSH, the Scheme Shell.
1877  upwardly compatible with SCSH regular expressions.  upwardly compatible with SCSH regular expressions.
1878    
1879  @c begin (scm-doc-string "regex.scm" "string-match")  @c begin (scm-doc-string "regex.scm" "string-match")
1880  @deffn procedure string-match pattern str [start]  @deffn {Scheme Procedure} string-match pattern str [start]
1881  Compile the string @var{pattern} into a regular expression and compare  Compile the string @var{pattern} into a regular expression and compare
1882  it with @var{str}.  The optional numeric argument @var{start} specifies  it with @var{str}.  The optional numeric argument @var{start} specifies
1883  the position of @var{str} at which to begin matching.  the position of @var{str} at which to begin matching.
# Line 1826  the same regular expression is used seve Line 1895  the same regular expression is used seve
1895  loop).  For better performance, you can compile a regular expression in  loop).  For better performance, you can compile a regular expression in
1896  advance and then match strings against the compiled regexp.  advance and then match strings against the compiled regexp.
1897    
1898  @deffn primitive make-regexp pat . flags  @deffn {Scheme Procedure} make-regexp pat . flags
1899    @deffnx {C Function} scm_make_regexp (pat, flags)
1900  Compile the regular expression described by @var{pat}, and  Compile the regular expression described by @var{pat}, and
1901  return the compiled regexp structure.  If @var{pat} does not  return the compiled regexp structure.  If @var{pat} does not
1902  describe a legal regular expression, @code{make-regexp} throws  describe a legal regular expression, @code{make-regexp} throws
# Line 1866  one which comes last will override the e Line 1936  one which comes last will override the e
1936  @end table  @end table
1937  @end deffn  @end deffn
1938    
1939  @deffn primitive regexp-exec rx str [start [flags]]  @deffn {Scheme Procedure} regexp-exec rx str [start [flags]]
1940    @deffnx {C Function} scm_regexp_exec (rx, str, start, flags)
1941  Match the compiled regular expression @var{rx} against  Match the compiled regular expression @var{rx} against
1942  @code{str}.  If the optional integer @var{start} argument is  @code{str}.  If the optional integer @var{start} argument is
1943  provided, begin matching from that position in the string.  provided, begin matching from that position in the string.
# Line 1888  considered the end of a line. Line 1959  considered the end of a line.
1959  @end table  @end table
1960  @end deffn  @end deffn
1961    
1962  @deffn primitive regexp? obj  @deffn {Scheme Procedure} regexp? obj
1963    @deffnx {C Function} scm_regexp_p (obj)
1964  Return @code{#t} if @var{obj} is a compiled regular expression,  Return @code{#t} if @var{obj} is a compiled regular expression,
1965  or @code{#f} otherwise.  or @code{#f} otherwise.
1966  @end deffn  @end deffn
# Line 1897  Regular expressions are commonly used to Line 1969  Regular expressions are commonly used to
1969  replace them with the contents of another string.  replace them with the contents of another string.
1970    
1971  @c begin (scm-doc-string "regex.scm" "regexp-substitute")  @c begin (scm-doc-string "regex.scm" "regexp-substitute")
1972  @deffn procedure regexp-substitute port match [item@dots{}]  @deffn {Scheme Procedure} regexp-substitute port match [item@dots{}]
1973  Write to the output port @var{port} selected contents of the match  Write to the output port @var{port} selected contents of the match
1974  structure @var{match}.  Each @var{item} specifies what should be  structure @var{match}.  Each @var{item} specifies what should be
1975  written, and may be one of the following arguments:  written, and may be one of the following arguments:
# Line 1924  the regexp match is written. Line 1996  the regexp match is written.
1996  @end deffn  @end deffn
1997    
1998  @c begin (scm-doc-string "regex.scm" "regexp-substitute")  @c begin (scm-doc-string "regex.scm" "regexp-substitute")
1999  @deffn procedure regexp-substitute/global port regexp target [item@dots{}]  @deffn {Scheme Procedure} regexp-substitute/global port regexp target [item@dots{}]
2000  Similar to @code{regexp-substitute}, but can be used to perform global  Similar to @code{regexp-substitute}, but can be used to perform global
2001  substitutions on @var{str}.  Instead of taking a match structure as an  substitutions on @var{str}.  Instead of taking a match structure as an
2002  argument, @code{regexp-substitute/global} takes two string arguments: a  argument, @code{regexp-substitute/global} takes two string arguments: a
# Line 1970  matched against a regular expression; we Line 2042  matched against a regular expression; we
2042  @var{target} for easy reference.  @var{target} for easy reference.
2043    
2044  @c begin (scm-doc-string "regex.scm" "regexp-match?")  @c begin (scm-doc-string "regex.scm" "regexp-match?")
2045  @deffn procedure regexp-match? obj  @deffn {Scheme Procedure} regexp-match? obj
2046  Return @code{#t} if @var{obj} is a match structure returned by a  Return @code{#t} if @var{obj} is a match structure returned by a
2047  previous call to @code{regexp-exec}, or @code{#f} otherwise.  previous call to @code{regexp-exec}, or @code{#f} otherwise.
2048  @end deffn  @end deffn
2049    
2050  @c begin (scm-doc-string "regex.scm" "match:substring")  @c begin (scm-doc-string "regex.scm" "match:substring")
2051  @deffn procedure match:substring match [n]  @deffn {Scheme Procedure} match:substring match [n]
2052  Return the portion of @var{target} matched by subexpression number  Return the portion of @var{target} matched by subexpression number
2053  @var{n}.  Submatch 0 (the default) represents the entire regexp match.  @var{n}.  Submatch 0 (the default) represents the entire regexp match.
2054  If the regular expression as a whole matched, but the subexpression  If the regular expression as a whole matched, but the subexpression
# Line 1984  number @var{n} did not match, return @co Line 2056  number @var{n} did not match, return @co
2056  @end deffn  @end deffn
2057    
2058  @c begin (scm-doc-string "regex.scm" "match:start")  @c begin (scm-doc-string "regex.scm" "match:start")
2059  @deffn procedure match:start match [n]  @deffn {Scheme Procedure} match:start match [n]
2060  Return the starting position of submatch number @var{n}.  Return the starting position of submatch number @var{n}.
2061  @end deffn  @end deffn
2062    
2063  @c begin (scm-doc-string "regex.scm" "match:end")  @c begin (scm-doc-string "regex.scm" "match:end")
2064  @deffn procedure match:end match [n]  @deffn {Scheme Procedure} match:end match [n]
2065  Return the ending position of submatch number @var{n}.  Return the ending position of submatch number @var{n}.
2066  @end deffn  @end deffn
2067    
2068  @c begin (scm-doc-string "regex.scm" "match:prefix")  @c begin (scm-doc-string "regex.scm" "match:prefix")
2069  @deffn procedure match:prefix match  @deffn {Scheme Procedure} match:prefix match
2070  Return the unmatched portion of @var{target} preceding the regexp match.  Return the unmatched portion of @var{target} preceding the regexp match.
2071  @end deffn  @end deffn
2072    
2073  @c begin (scm-doc-string "regex.scm" "match:suffix")  @c begin (scm-doc-string "regex.scm" "match:suffix")
2074  @deffn procedure match:suffix match  @deffn {Scheme Procedure} match:suffix match
2075  Return the unmatched portion of @var{target} following the regexp match.  Return the unmatched portion of @var{target} following the regexp match.
2076  @end deffn  @end deffn
2077    
2078  @c begin (scm-doc-string "regex.scm" "match:count")  @c begin (scm-doc-string "regex.scm" "match:count")
2079  @deffn procedure match:count match  @deffn {Scheme Procedure} match:count match
2080  Return the number of parenthesized subexpressions from @var{match}.  Return the number of parenthesized subexpressions from @var{match}.
2081  Note that the entire regular expression match itself counts as a  Note that the entire regular expression match itself counts as a
2082  subexpression, and failed submatches are included in the count.  subexpression, and failed submatches are included in the count.
2083  @end deffn  @end deffn
2084    
2085  @c begin (scm-doc-string "regex.scm" "match:string")  @c begin (scm-doc-string "regex.scm" "match:string")
2086  @deffn procedure match:string match  @deffn {Scheme Procedure} match:string match
2087  Return the original @var{target} string.  Return the original @var{target} string.
2088  @end deffn  @end deffn
2089    
# Line 2045  by any number of alphabetic characters. Line 2117  by any number of alphabetic characters.
2117  regexp each match a single backslash in the target string.  regexp each match a single backslash in the target string.
2118    
2119  @c begin (scm-doc-string "regex.scm" "regexp-quote")  @c begin (scm-doc-string "regex.scm" "regexp-quote")
2120  @deffn procedure regexp-quote str  @deffn {Scheme Procedure} regexp-quote str
2121  Quote each special character found in @var{str} with a backslash, and  Quote each special character found in @var{str} with a backslash, and
2122  return the resulting string.  return the resulting string.
2123  @end deffn  @end deffn
# Line 2134  guile> Line 2206  guile>
2206  The definitions of @code{regcomp} and @code{regexec} are as follows:  The definitions of @code{regcomp} and @code{regexec} are as follows:
2207    
2208  @c NJFIXME not in libguile!  @c NJFIXME not in libguile!
2209  @deffn primitive regcomp pattern [flags]  @deffn {Scheme Procedure} regcomp pattern [flags]
2210  Compile the regular expression pattern using POSIX rules.  Flags is  Compile the regular expression pattern using POSIX rules.  Flags is
2211  optional and should be specified using symbolic names:  optional and should be specified using symbolic names:
2212  @defvar REG_EXTENDED  @defvar REG_EXTENDED
# Line 2157  literal string e.g., @code{"\\(a\\)\\?"} Line 2229  literal string e.g., @code{"\\(a\\)\\?"}
2229  @end deffn  @end deffn
2230    
2231  @c NJFIXME not in libguile!  @c NJFIXME not in libguile!
2232  @deffn primitive regexec regex string [match-pick] [flags]  @deffn {Scheme Procedure} regexec regex string [match-pick] [flags]
2233    
2234  Match @var{string} against the compiled POSIX regular expression  Match @var{string} against the compiled POSIX regular expression
2235  @var{regex}.  @var{regex}.
# Line 2216  Here are some other procedures that migh Line 2288  Here are some other procedures that migh
2288  expressions:  expressions:
2289    
2290  @c NJFIXME not in libguile!  @c NJFIXME not in libguile!
2291  @deffn primitive compiled-regexp? obj  @deffn {Scheme Procedure} compiled-regexp? obj
2292  Test whether obj is a compiled regular expression.  Test whether obj is a compiled regular expression.
2293  @end deffn  @end deffn
2294    
2295  @c NJFIXME not in libguile!  @c NJFIXME not in libguile!
2296  @deffn primitive regexp->dfa regex [flags]  @deffn {Scheme Procedure} regexp->dfa regex [flags]
2297  @end deffn  @end deffn
2298    
2299  @c NJFIXME not in libguile!  @c NJFIXME not in libguile!
2300  @deffn primitive dfa-fork dfa  @deffn {Scheme Procedure} dfa-fork dfa
2301  @end deffn  @end deffn
2302    
2303  @c NJFIXME not in libguile!  @c NJFIXME not in libguile!
2304  @deffn primitive reset-dfa! dfa  @deffn {Scheme Procedure} reset-dfa! dfa
2305  @end deffn  @end deffn
2306    
2307  @c NJFIXME not in libguile!  @c NJFIXME not in libguile!
2308  @deffn primitive dfa-final-tag dfa  @deffn {Scheme Procedure} dfa-final-tag dfa
2309  @end deffn  @end deffn
2310    
2311  @c NJFIXME not in libguile!  @c NJFIXME not in libguile!
2312  @deffn primitive dfa-continuable? dfa  @deffn {Scheme Procedure} dfa-continuable? dfa
2313  @end deffn  @end deffn
2314    
2315  @c NJFIXME not in libguile!  @c NJFIXME not in libguile!
2316  @deffn primitive advance-dfa! dfa string  @deffn {Scheme Procedure} advance-dfa! dfa string
2317  @end deffn  @end deffn
2318    
2319    
# Line 2323  Usage of this form of read syntax is dis Line 2395  Usage of this form of read syntax is dis
2395  portable at all, and is not very readable.  portable at all, and is not very readable.
2396    
2397  @rnindex symbol?  @rnindex symbol?
2398  @deffn primitive symbol? obj  @deffn {Scheme Procedure} symbol? obj
2399    @deffnx {C Function} scm_symbol_p (obj)
2400  Return @code{#t} if @var{obj} is a symbol, otherwise return  Return @code{#t} if @var{obj} is a symbol, otherwise return
2401  @code{#f}.  @code{#f}.
2402  @end deffn  @end deffn
2403    
2404  @rnindex string->symbol  @rnindex string->symbol
2405  @deffn primitive string->symbol string  @deffn {Scheme Procedure} string->symbol string
2406    @deffnx {C Function} scm_string_to_symbol (string)
2407  Return the symbol whose name is @var{string}. This procedure  Return the symbol whose name is @var{string}. This procedure
2408  can create symbols with names containing special characters or  can create symbols with names containing special characters or
2409  letters in the non-standard case, but it is usually a bad idea  letters in the non-standard case, but it is usually a bad idea
# Line 2353  standard case is lower case: Line 2427  standard case is lower case:
2427  @end deffn  @end deffn
2428    
2429  @rnindex symbol->string  @rnindex symbol->string
2430  @deffn primitive symbol->string s  @deffn {Scheme Procedure} symbol->string s
2431    @deffnx {C Function} scm_symbol_to_string (s)
2432  Return the name of @var{symbol} as a string.  If the symbol was  Return the name of @var{symbol} as a string.  If the symbol was
2433  part of an object returned as the value of a literal expression  part of an object returned as the value of a literal expression
2434  (section @pxref{Literal expressions,,,r5rs, The Revised^5  (section @pxref{Literal expressions,,,r5rs, The Revised^5
# Line 2391  Each entry in the alists is a pair (@var Line 2466  Each entry in the alists is a pair (@var
2466  (@var{SYMBOL} . @var{VALUE}) pair, adding a new entry to the symbol  (@var{SYMBOL} . @var{VALUE}) pair, adding a new entry to the symbol
2467  table (with an undefined value) if none is yet present.  table (with an undefined value) if none is yet present.
2468    
2469  @deffn primitive gensym [prefix]  @deffn {Scheme Procedure} gensym [prefix]
2470    @deffnx {C Function} scm_gensym (prefix)
2471  Create a new symbol with a name constructed from a prefix and  Create a new symbol with a name constructed from a prefix and
2472  a counter value. The string @var{prefix} can be specified as  a counter value. The string @var{prefix} can be specified as
2473  an optional argument. Default prefix is @code{g}.  The counter  an optional argument. Default prefix is @code{ g}.  The counter
2474  is increased by 1 at each call. There is no provision for  is increased by 1 at each call. There is no provision for
2475  resetting the counter.  resetting the counter.
2476  @end deffn  @end deffn
2477    
2478  @deffn primitive gentemp [prefix [obarray]]  @deffn {Scheme Procedure} gentemp [prefix [obarray]]
2479    @deffnx {C Function} scm_gentemp (prefix, obarray)
2480  Create a new symbol with a name unique in an obarray.  Create a new symbol with a name unique in an obarray.
2481  The name is constructed from an optional string @var{prefix}  The name is constructed from an optional string @var{prefix}
2482  and a counter value.  The default prefix is @code{t}.  The  and a counter value.  The default prefix is @code{t}.  The
# Line 2409  interned.  The counter is increased by 1 Line 2486  interned.  The counter is increased by 1
2486  call.  There is no provision for resetting the counter.  call.  There is no provision for resetting the counter.
2487  @end deffn  @end deffn
2488    
2489  @deffn primitive intern-symbol obarray string  @deffn {Scheme Procedure} intern-symbol obarray string
2490    @deffnx {C Function} scm_intern_symbol (obarray, string)
2491  Add a new symbol to @var{obarray} with name @var{string}, bound to an  Add a new symbol to @var{obarray} with name @var{string}, bound to an
2492  unspecified initial value.  The symbol table is not modified if a symbol  unspecified initial value.  The symbol table is not modified if a symbol
2493  with this name is already present.  with this name is already present.
2494  @end deffn  @end deffn
2495    
2496  @deffn primitive string->obarray-symbol obarray string [soft?]  @deffn {Scheme Procedure} string->obarray-symbol obarray string [soft?]
2497    @deffnx {C Function} scm_string_to_obarray_symbol (obarray, string, soft_p)
2498  Intern a new symbol in @var{obarray}, a symbol table, with name  Intern a new symbol in @var{obarray}, a symbol table, with name
2499  @var{string}.  @var{string}.
2500    
2501    If @var{obarray} is @code{#f}, use the default system symbol table.  If
2502    @var{obarray} is @code{#t}, the symbol should not be interned in any
2503    symbol table; merely return the pair (@var{symbol}
2504    . @var{#<undefined>}).
2505    
2506    The @var{soft?} argument determines whether new symbol table entries
2507    should be created when the specified symbol is not already present in
2508    @var{obarray}.  If @var{soft?} is specified and is a true value, then
2509    new entries should not be added for symbols not already present in the
2510    table; instead, simply return @code{#f}.
2511  @end deffn  @end deffn
2512    
2513  @deffn primitive symbol-binding obarray string  @deffn {Scheme Procedure} symbol-binding obarray string
2514    @deffnx {C Function} scm_symbol_binding (obarray, string)
2515  Look up in @var{obarray} the symbol whose name is @var{string}, and  Look up in @var{obarray} the symbol whose name is @var{string}, and
2516  return the value to which it is bound.  If @var{obarray} is @code{#f},  return the value to which it is bound.  If @var{obarray} is @code{#f},
2517  use the global symbol table.  If @var{string} is not interned in  use the global symbol table.  If @var{string} is not interned in
2518  @var{obarray}, an error is signalled.  @var{obarray}, an error is signalled.
2519  @end deffn  @end deffn
2520    
2521  @deffn primitive symbol-bound? obarray string  @deffn {Scheme Procedure} symbol-bound? obarray string
2522    @deffnx {C Function} scm_symbol_bound_p (obarray, string)
2523  Return @code{#t} if @var{obarray} contains a symbol with name  Return @code{#t} if @var{obarray} contains a symbol with name
2524  @var{string} bound to a defined value.  This differs from  @var{string} bound to a defined value.  This differs from
2525  @var{symbol-interned?} in that the mere mention of a symbol  @var{symbol-interned?} in that the mere mention of a symbol
# Line 2436  determines whether a symbol has been giv Line 2528  determines whether a symbol has been giv
2528  value.  value.
2529  @end deffn  @end deffn
2530    
2531  @deffn primitive symbol-fref symbol  @deffn {Scheme Procedure} symbol-fref symbol
2532    @deffnx {C Function} scm_symbol_fref (symbol)
2533  Return the contents of @var{symbol}'s @dfn{function slot}.  Return the contents of @var{symbol}'s @dfn{function slot}.
2534  @end deffn  @end deffn
2535    
2536  @deffn primitive symbol-fset! symbol value  @deffn {Scheme Procedure} symbol-fset! symbol value
2537    @deffnx {C Function} scm_symbol_fset_x (symbol, value)
2538  Change the binding of @var{symbol}'s function slot.  Change the binding of @var{symbol}'s function slot.
2539  @end deffn  @end deffn
2540    
2541  @deffn primitive symbol-hash symbol  @deffn {Scheme Procedure} symbol-hash symbol
2542    @deffnx {C Function} scm_symbol_hash (symbol)
2543  Return a hash value for @var{symbol}.  Return a hash value for @var{symbol}.
2544  @end deffn  @end deffn
2545    
2546  @deffn primitive symbol-interned? obarray string  @deffn {Scheme Procedure} symbol-interned? obarray string
2547    @deffnx {C Function} scm_symbol_interned_p (obarray, string)
2548  Return @code{#t} if @var{obarray} contains a symbol with name  Return @code{#t} if @var{obarray} contains a symbol with name
2549  @var{string}, and @code{#f} otherwise.  @var{string}, and @code{#f} otherwise.
2550  @end deffn  @end deffn
2551    
2552  @deffn primitive symbol-pref symbol  @deffn {Scheme Procedure} symbol-pref symbol
2553    @deffnx {C Function} scm_symbol_pref (symbol)
2554  Return the @dfn{property list} currently associated with @var{symbol}.  Return the @dfn{property list} currently associated with @var{symbol}.
2555  @end deffn  @end deffn
2556    
2557  @deffn primitive symbol-pset! symbol value  @deffn {Scheme Procedure} symbol-pset! symbol value
2558    @deffnx {C Function} scm_symbol_pset_x (symbol, value)
2559  Change the binding of @var{symbol}'s property slot.  Change the binding of @var{symbol}'s property slot.
2560  @end deffn  @end deffn
2561    
2562  @deffn primitive symbol-set! obarray string value  @deffn {Scheme Procedure} symbol-set! obarray string value
2563    @deffnx {C Function} scm_symbol_set_x (obarray, string, value)
2564  Find the symbol in @var{obarray} whose name is @var{string}, and rebind  Find the symbol in @var{obarray} whose name is @var{string}, and rebind
2565  it to @var{value}.  An error is signalled if @var{string} is not present  it to @var{value}.  An error is signalled if @var{string} is not present
2566  in @var{obarray}.  in @var{obarray}.
2567  @end deffn  @end deffn
2568    
2569  @deffn primitive unintern-symbol obarray string  @deffn {Scheme Procedure} unintern-symbol obarray string
2570    @deffnx {C Function} scm_unintern_symbol (obarray, string)
2571  Remove the symbol with name @var{string} from @var{obarray}.  This  Remove the symbol with name @var{string} from @var{obarray}.  This
2572  function returns @code{#t} if the symbol was present and @code{#f}  function returns @code{#t} if the symbol was present and @code{#f}
2573  otherwise.  otherwise.
# Line 2489  one of the constructor procedures @code{ Line 2589  one of the constructor procedures @code{
2589  First-class variables are especially useful for interacting with the  First-class variables are especially useful for interacting with the
2590  current module system (@pxref{The Guile module system}).  current module system (@pxref{The Guile module system}).
2591    
2592  @deffn primitive builtin-variable name  @deffn {Scheme Procedure} builtin-variable name
2593    @deffnx {C Function} scm_builtin_variable (name)
2594  Return the built-in variable with the name @var{name}.  Return the built-in variable with the name @var{name}.
2595  @var{name} must be a symbol (not a string).  @var{name} must be a symbol (not a string).
2596  Then use @code{variable-ref} to access its value.  Then use @code{variable-ref} to access its value.
2597  @end deffn  @end deffn
2598    
2599  @deffn primitive make-undefined-variable  @deffn {Scheme Procedure} make-undefined-variable
2600    @deffnx {C Function} scm_make_undefined_variable ()
2601  Return a variable that is initially unbound.  Return a variable that is initially unbound.
2602  @end deffn  @end deffn
2603    
2604  @deffn primitive make-variable init  @deffn {Scheme Procedure} make-variable init
2605    @deffnx {C Function} scm_make_variable (init)
2606  Return a variable initialized to value @var{init}.  Return a variable initialized to value @var{init}.
2607  @end deffn  @end deffn
2608    
2609  @deffn primitive variable-bound? var  @deffn {Scheme Procedure} variable-bound? var
2610    @deffnx {C Function} scm_variable_bound_p (var)
2611  Return @code{#t} iff @var{var} is bound to a value.  Return @code{#t} iff @var{var} is bound to a value.
2612  Throws an error if @var{var} is not a variable object.  Throws an error if @var{var} is not a variable object.
2613  @end deffn  @end deffn
2614    
2615  @deffn primitive variable-ref var  @deffn {Scheme Procedure} variable-ref var
2616    @deffnx {C Function} scm_variable_ref (var)
2617  Dereference @var{var} and return its value.  Dereference @var{var} and return its value.
2618  @var{var} must be a variable object; see @code{make-variable}  @var{var} must be a variable object; see @code{make-variable}
2619  and @code{make-undefined-variable}.  and @code{make-undefined-variable}.
2620  @end deffn  @end deffn
2621    
2622  @deffn primitive variable-set! var val  @deffn {Scheme Procedure} variable-set! var val
2623    @deffnx {C Function} scm_variable_set_x (var, val)
2624  Set the value of the variable @var{var} to @var{val}.  Set the value of the variable @var{var} to @var{val}.
2625  @var{var} must be a variable object, @var{val} can be any  @var{var} must be a variable object, @var{val} can be any
2626  value. Return an unspecified value.  value. Return an unspecified value.
2627  @end deffn  @end deffn
2628    
2629  @deffn primitive variable? obj  @deffn {Scheme Procedure} variable? obj
2630    @deffnx {C Function} scm_variable_p (obj)
2631  Return @code{#t} iff @var{obj} is a variable object, else  Return @code{#t} iff @var{obj} is a variable object, else
2632  return @code{#f}.  return @code{#f}.
2633  @end deffn  @end deffn
# Line 2714  ABORT: (unbound-variable) Line 2821  ABORT: (unbound-variable)
2821  The following procedures can be used for converting symbols to keywords  The following procedures can be used for converting symbols to keywords
2822  and back.  and back.
2823    
2824  @deffn procedure symbol->keyword sym  @deffn {Scheme Procedure} symbol->keyword sym
2825  Return a keyword with the same characters as in @var{sym}.  Return a keyword with the same characters as in @var{sym}.
2826  @end deffn  @end deffn
2827    
2828  @deffn procedure keyword->symbol kw  @deffn {Scheme Procedure} keyword->symbol kw
2829  Return a symbol with the same characters as in @var{kw}.  Return a symbol with the same characters as in @var{kw}.
2830  @end deffn  @end deffn
2831    
# Line 2739  construct a keyword object programmatica Line 2846  construct a keyword object programmatica
2846  (as the reader does).  The dash symbol for a keyword object can be  (as the reader does).  The dash symbol for a keyword object can be
2847  retrieved using the @code{keyword-dash-symbol} procedure.  retrieved using the @code{keyword-dash-symbol} procedure.
2848    
2849  @deffn primitive make-keyword-from-dash-symbol symbol  @deffn {Scheme Procedure} make-keyword-from-dash-symbol symbol
2850    @deffnx {C Function} scm_make_keyword_from_dash_symbol (symbol)
2851  Make a keyword object from a @var{symbol} that starts with a dash.  Make a keyword object from a @var{symbol} that starts with a dash.
2852  @end deffn  @end deffn
2853    
2854  @deffn primitive keyword? obj  @deffn {Scheme Procedure} keyword? obj
2855    @deffnx {C Function} scm_keyword_p (obj)
2856  Return @code{#t} if the argument @var{obj} is a keyword, else  Return @code{#t} if the argument @var{obj} is a keyword, else
2857  @code{#f}.  @code{#f}.
2858  @end deffn  @end deffn
2859    
2860  @deffn primitive keyword-dash-symbol keyword  @deffn {Scheme Procedure} keyword-dash-symbol keyword
2861    @deffnx {C Function} scm_keyword_dash_symbol (keyword)
2862  Return the dash symbol for @var{keyword}.  Return the dash symbol for @var{keyword}.
2863  This is the inverse of @code{make-keyword-from-dash-symbol}.  This is the inverse of @code{make-keyword-from-dash-symbol}.
2864  @end deffn  @end deffn
# Line 2801  pair, and the pair is returned.  The nam Line 2911  pair, and the pair is returned.  The nam
2911  given Scheme object is a pair or not.  given Scheme object is a pair or not.
2912    
2913  @rnindex cons  @rnindex cons
2914  @deffn primitive cons x y  @deffn {Scheme Procedure} cons x y
2915    @deffnx {C Function} scm_cons (x, y)
2916  Return a newly allocated pair whose car is @var{x} and whose  Return a newly allocated pair whose car is @var{x} and whose
2917  cdr is @var{y}.  The pair is guaranteed to be different (in the  cdr is @var{y}.  The pair is guaranteed to be different (in the
2918  sense of @code{eq?}) from every previously existing object.  sense of @code{eq?}) from every previously existing object.
2919  @end deffn  @end deffn
2920    
2921  @rnindex pair?  @rnindex pair?
2922  @deffn primitive pair? x  @deffn {Scheme Procedure} pair? x
2923    @deffnx {C Function} scm_pair_p (x)
2924  Return @code{#t} if @var{x} is a pair; otherwise return  Return @code{#t} if @var{x} is a pair; otherwise return
2925  @code{#f}.  @code{#f}.
2926  @end deffn  @end deffn
# Line 2823  are also predefined. Line 2935  are also predefined.
2935    
2936  @rnindex car  @rnindex car
2937  @rnindex cdr  @rnindex cdr
2938  @deffn primitive car pair  @deffn {Scheme Procedure} car pair
2939  @deffnx primitive cdr pair  @deffnx {Scheme Procedure} cdr pair
2940  Return the car or the cdr of @var{pair}, respectively.  Return the car or the cdr of @var{pair}, respectively.
2941  @end deffn  @end deffn
2942    
2943  @deffn primitive caar pair  @deffn {Scheme Procedure} caar pair
2944  @deffnx primitive cadr pair @dots{}  @deffnx {Scheme Procedure} cadr pair @dots{}
2945  @deffnx primitive cdddar pair  @deffnx {Scheme Procedure} cdddar pair
2946  @deffnx primitive cddddr pair  @deffnx {Scheme Procedure} cddddr pair
2947  These procedures are compositions of @code{car} and @code{cdr}, where  These procedures are compositions of @code{car} and @code{cdr}, where
2948  for example @code{caddr} could be defined by  for example @code{caddr} could be defined by
2949    
# Line 2841  for example @code{caddr} could be define Line 2953  for example @code{caddr} could be define
2953  @end deffn  @end deffn
2954    
2955  @rnindex set-car!  @rnindex set-car!
2956  @deffn primitive set-car! pair value  @deffn {Scheme Procedure} set-car! pair value
2957    @deffnx {C Function} scm_set_car_x (pair, value)
2958  Stores @var{value} in the car field of @var{pair}.  The value returned  Stores @var{value} in the car field of @var{pair}.  The value returned
2959  by @code{set-car!} is unspecified.  by @code{set-car!} is unspecified.
2960  @end deffn  @end deffn
2961    
2962  @rnindex set-cdr!  @rnindex set-cdr!
2963  @deffn primitive set-cdr! pair value  @deffn {Scheme Procedure} set-cdr! pair value
2964    @deffnx {C Function} scm_set_cdr_x (pair, value)
2965  Stores @var{value} in the cdr field of @var{pair}.  The value returned  Stores @var{value} in the cdr field of @var{pair}.  The value returned
2966  by @code{set-cdr!} is unspecified.  by @code{set-cdr!} is unspecified.
2967  @end deffn  @end deffn
# Line 2934  whether their input is valid, or they co Line 3048  whether their input is valid, or they co
3048  depending on the datatype of their arguments.  depending on the datatype of their arguments.
3049    
3050  @rnindex list?  @rnindex list?
3051  @deffn primitive list? x  @deffn {Scheme Procedure} list? x
3052    @deffnx {C Function} scm_list_p (x)
3053  Return @code{#t} iff @var{x} is a proper list, else @code{#f}.  Return @code{#t} iff @var{x} is a proper list, else @code{#f}.
3054  @end deffn  @end deffn
3055    
# Line 2944  somehow deals with the elements of a lis Line 3059  somehow deals with the elements of a lis
3059  @code{null?}.  Then, the algorithm terminates.  @code{null?}.  Then, the algorithm terminates.
3060    
3061  @rnindex null?  @rnindex null?
3062  @deffn primitive null? x  @deffn {Scheme Procedure} null? x
3063    @deffnx {C Function} scm_null_p (x)
3064  Return @code{#t} iff @var{x} is the empty list, else @code{#f}.  Return @code{#t} iff @var{x} is the empty list, else @code{#f}.
3065  @end deffn  @end deffn
3066    
# Line 2957  This section describes the procedures fo Line 3073  This section describes the procedures fo
3073  the last pair of the list.  the last pair of the list.
3074    
3075  @rnindex list  @rnindex list
3076  @deffn primitive list arg1 @dots{}  @deffn {Scheme Procedure} list . objs
3077    @deffnx {C Function} scm_list (objs)
3078  Return a list containing @var{objs}, the arguments to  Return a list containing @var{objs}, the arguments to
3079  @code{list}.  @code{list}.
3080  @end deffn  @end deffn
3081    
3082  @deffn primitive cons* arg1 arg2 @dots{}  @deffn {Scheme Procedure} cons* arg1 arg2 @dots{}
3083    @deffnx {C Function} scm_cons_star (arg1, rest)
3084  Like @code{list}, but the last arg provides the tail of the  Like @code{list}, but the last arg provides the tail of the
3085  constructed list, returning @code{(cons @var{arg1} (cons  constructed list, returning @code{(cons @var{arg1} (cons
3086  @var{arg2} (cons @dots{} @var{argn})))}.  Requires at least one  @var{arg2} (cons @dots{} @var{argn})))}.  Requires at least one
# Line 2971  result.  This function is called @code{l Line 3089  result.  This function is called @code{l
3089  Schemes and in Common LISP.  Schemes and in Common LISP.
3090  @end deffn  @end deffn
3091    
3092  @deffn primitive list-copy lst  @deffn {Scheme Procedure} list-copy lst
3093    @deffnx {C Function} scm_list_copy (lst)
3094  Return a (newly-created) copy of @var{lst}.  Return a (newly-created) copy of @var{lst}.
3095  @end deffn  @end deffn
3096    
3097  @deffn procedure make-list n [init]  @deffn {Scheme Procedure} make-list n [init]
3098  Create a list containing of @var{n} elements, where each element is  Create a list containing of @var{n} elements, where each element is
3099  initialized to @var{init}.  @var{init} defaults to the empty list  initialized to @var{init}.  @var{init} defaults to the empty list
3100  @code{()} if not given.  @code{()} if not given.
# Line 2996  These procedures are used to get some in Line 3115  These procedures are used to get some in
3115  retrieve one or more elements of a list.  retrieve one or more elements of a list.
3116    
3117  @rnindex length  @rnindex length
3118  @deffn primitive length lst  @deffn {Scheme Procedure} length lst
3119    @deffnx {C Function} scm_length (lst)
3120  Return the number of elements in list @var{lst}.  Return the number of elements in list @var{lst}.
3121  @end deffn  @end deffn
3122    
3123  @deffn primitive last-pair lst  @deffn {Scheme Procedure} last-pair lst
3124    @deffnx {C Function} scm_last_pair (lst)
3125  Return a pointer to the last pair in @var{lst}, signalling an error if  Return a pointer to the last pair in @var{lst}, signalling an error if
3126  @var{lst} is circular.  @var{lst} is circular.
3127  @end deffn  @end deffn
3128    
3129  @rnindex list-ref  @rnindex list-ref
3130  @deffn primitive list-ref list k  @deffn {Scheme Procedure} list-ref list k
3131    @deffnx {C Function} scm_list_ref (list, k)
3132  Return the @var{k}th element from @var{list}.  Return the @var{k}th element from @var{list}.
3133  @end deffn  @end deffn
3134    
3135  @rnindex list-tail  @rnindex list-tail
3136  @deffn primitive list-tail lst k  @deffn {Scheme Procedure} list-tail lst k
3137  @deffnx primitive list-cdr-ref lst k  @deffnx {Scheme Procedure} list-cdr-ref lst k
3138    @deffnx {C Function} scm_list_tail (lst, k)
3139  Return the "tail" of @var{lst} beginning with its @var{k}th element.  Return the "tail" of @var{lst} beginning with its @var{k}th element.
3140  The first element of the list is considered to be element 0.  The first element of the list is considered to be element 0.
3141    
# Line 3021  think of @code{list-cdr-ref} as accessin Line 3144  think of @code{list-cdr-ref} as accessin
3144  or returning the results of cdring @var{k} times down @var{lst}.  or returning the results of cdring @var{k} times down @var{lst}.
3145  @end deffn  @end deffn
3146    
3147  @deffn primitive list-head lst k  @deffn {Scheme Procedure} list-head lst k
3148    @deffnx {C Function} scm_list_head (lst, k)
3149  Copy the first @var{k} elements from @var{lst} into a new list, and  Copy the first @var{k} elements from @var{lst} into a new list, and
3150  return it.  return it.
3151  @end deffn  @end deffn
# Line 3038  pairs.  This is why you should be carefu Line 3162  pairs.  This is why you should be carefu
3162  variants.  variants.
3163    
3164  @rnindex append  @rnindex append
3165  @deffn primitive append . args  @deffn {Scheme Procedure} append . args
3166    @deffnx {C Function} scm_append (args)
3167  Return a list consisting of the elements the lists passed as  Return a list consisting of the elements the lists passed as
3168  arguments.  arguments.
3169  @lisp  @lisp
# Line 3056  if the last argument is not a proper lis Line 3181  if the last argument is not a proper lis
3181  @end lisp  @end lisp
3182  @end deffn  @end deffn
3183    
3184  @deffn primitive append! . lists  @deffn {Scheme Procedure} append! . lists
3185    @deffnx {C Function} scm_append_x (lists)
3186  A destructive version of @code{append} (@pxref{Pairs and  A destructive version of @code{append} (@pxref{Pairs and
3187  lists,,,r5rs, The Revised^5 Report on Scheme}).  The cdr field  lists,,,r5rs, The Revised^5 Report on Scheme}).  The cdr field
3188  of each list's final pair is changed to point to the head of  of each list's final pair is changed to point to the head of
# Line 3065  the mutated list. Line 3191  the mutated list.
3191  @end deffn  @end deffn
3192    
3193  @rnindex reverse  @rnindex reverse
3194  @deffn primitive reverse lst  @deffn {Scheme Procedure} reverse lst
3195    @deffnx {C Function} scm_reverse (lst)
3196  Return a new list that contains the elements of @var{lst} but  Return a new list that contains the elements of @var{lst} but
3197  in reverse order.  in reverse order.
3198  @end deffn  @end deffn
3199    
3200  @c NJFIXME explain new_tail  @c NJFIXME explain new_tail
3201  @deffn primitive reverse! lst [new_tail]  @deffn {Scheme Procedure} reverse! lst [new_tail]
3202    @deffnx {C Function} scm_reverse_x (lst, new_tail)
3203  A destructive version of @code{reverse} (@pxref{Pairs and lists,,,r5rs,  A destructive version of @code{reverse} (@pxref{Pairs and lists,,,r5rs,
3204  The Revised^5 Report on Scheme}).  The cdr of each cell in @var{lst} is  The Revised^5 Report on Scheme}).  The cdr of each cell in @var{lst} is
3205  modified to point to the previous list element.  Return a pointer to the  modified to point to the previous list element.  Return a pointer to the
# Line 3091  of the modified list is not lost, it is Line 3219  of the modified list is not lost, it is
3219  The following procedures modify an existing list, either by changing  The following procedures modify an existing list, either by changing
3220  elements of the list, or by changing the list structure itself.  elements of the list, or by changing the list structure itself.
3221    
3222  @deffn primitive list-set! list k val  @deffn {Scheme Procedure} list-set! list k val
3223    @deffnx {C Function} scm_list_set_x (list, k, val)
3224  Set the @var{k}th element of @var{list} to @var{val}.  Set the @var{k}th element of @var{list} to @var{val}.
3225  @end deffn  @end deffn
3226    
3227  @deffn primitive list-cdr-set! list k val  @deffn {Scheme Procedure} list-cdr-set! list k val
3228    @deffnx {C Function} scm_list_cdr_set_x (list, k, val)
3229  Set the @var{k}th cdr of @var{list} to @var{val}.  Set the @var{k}th cdr of @var{list} to @var{val}.
3230  @end deffn  @end deffn
3231    
3232  @deffn primitive delq item lst  @deffn {Scheme Procedure} delq item lst
3233    @deffnx {C Function} scm_delq (item, lst)
3234  Return a newly-created copy of @var{lst} with elements  Return a newly-created copy of @var{lst} with elements
3235  @code{eq?} to @var{item} removed.  This procedure mirrors  @code{eq?} to @var{item} removed.  This procedure mirrors
3236  @code{memq}: @code{delq} compares elements of @var{lst} against  @code{memq}: @code{delq} compares elements of @var{lst} against
3237  @var{item} with @code{eq?}.  @var{item} with @code{eq?}.
3238  @end deffn  @end deffn
3239    
3240  @deffn primitive delv item lst  @deffn {Scheme Procedure} delv item lst
3241    @deffnx {C Function} scm_delv (item, lst)
3242  Return a newly-created copy of @var{lst} with elements  Return a newly-created copy of @var{lst} with elements
3243  @code{eqv?}  to @var{item} removed.  This procedure mirrors  @code{eqv?}  to @var{item} removed.  This procedure mirrors
3244  @code{memv}: @code{delv} compares elements of @var{lst} against  @code{memv}: @code{delv} compares elements of @var{lst} against
3245  @var{item} with @code{eqv?}.  @var{item} with @code{eqv?}.
3246  @end deffn  @end deffn
3247    
3248  @deffn primitive delete item lst  @deffn {Scheme Procedure} delete item lst
3249    @deffnx {C Function} scm_delete (item, lst)
3250  Return a newly-created copy of @var{lst} with elements  Return a newly-created copy of @var{lst} with elements
3251  @code{equal?}  to @var{item} removed.  This procedure mirrors  @code{equal?}  to @var{item} removed.  This procedure mirrors
3252  @code{member}: @code{delete} compares elements of @var{lst}  @code{member}: @code{delete} compares elements of @var{lst}
3253  against @var{item} with @code{equal?}.  against @var{item} with @code{equal?}.
3254  @end deffn  @end deffn
3255    
3256  @deffn primitive delq! item lst  @deffn {Scheme Procedure} delq! item lst
3257  @deffnx primitive delv! item lst  @deffnx {Scheme Procedure} delv! item lst
3258  @deffnx primitive delete! item lst  @deffnx {Scheme Procedure} delete! item lst
3259    @deffnx {C Function} scm_delq_x (item, lst)
3260  These procedures are destructive versions of @code{delq}, @code{delv}  These procedures are destructive versions of @code{delq}, @code{delv}
3261  and @code{delete}: they modify the pointers in the existing @var{lst}  and @code{delete}: they modify the pointers in the existing @var{lst}
3262  rather than creating a new list.  Caveat evaluator: Like other  rather than creating a new list.  Caveat evaluator: Like other
# Line 3131  destructive list functions, these functi Line 3265  destructive list functions, these functi
3265  @var{lst} destructively.  @var{lst} destructively.
3266  @end deffn  @end deffn
3267    
3268  @deffn primitive delq1! item lst  @deffn {Scheme Procedure} delq1! item lst
3269    @deffnx {C Function} scm_delq1_x (item, lst)
3270  Like @code{delq!}, but only deletes the first occurrence of  Like @code{delq!}, but only deletes the first occurrence of
3271  @var{item} from @var{lst}.  Tests for equality using  @var{item} from @var{lst}.  Tests for equality using
3272  @code{eq?}.  See also @code{delv1!} and @code{delete1!}.  @code{eq?}.  See also @code{delv1!} and @code{delete1!}.
3273  @end deffn  @end deffn
3274    
3275  @deffn primitive delv1! item lst  @deffn {Scheme Procedure} delv1! item lst
3276    @deffnx {C Function} scm_delv1_x (item, lst)
3277  Like @code{delv!}, but only deletes the first occurrence of  Like @code{delv!}, but only deletes the first occurrence of
3278  @var{item} from @var{lst}.  Tests for equality using  @var{item} from @var{lst}.  Tests for equality using
3279  @code{eqv?}.  See also @code{delq1!} and @code{delete1!}.  @code{eqv?}.  See also @code{delq1!} and @code{delete1!}.
3280  @end deffn  @end deffn
3281    
3282  @deffn primitive delete1! item lst  @deffn {Scheme Procedure} delete1! item lst
3283    @deffnx {C Function} scm_delete1_x (item, lst)
3284  Like @code{delete!}, but only deletes the first occurrence of  Like @code{delete!}, but only deletes the first occurrence of
3285  @var{item} from @var{lst}.  Tests for equality using  @var{item} from @var{lst}.  Tests for equality using
3286  @code{equal?}.  See also @code{delq1!} and @code{delv1!}.  @code{equal?}.  See also @code{delq1!} and @code{delv1!}.
# Line 3159  they return the sublist whose car is equ Line 3296  they return the sublist whose car is equ
3296  equality depends on the equality predicate used.  equality depends on the equality predicate used.
3297    
3298  @rnindex memq  @rnindex memq
3299  @deffn primitive memq x lst  @deffn {Scheme Procedure} memq x lst
3300    @deffnx {C Function} scm_memq (x, lst)
3301  Return the first sublist of @var{lst} whose car is @code{eq?}  Return the first sublist of @var{lst} whose car is @code{eq?}
3302  to @var{x} where the sublists of @var{lst} are the non-empty  to @var{x} where the sublists of @var{lst} are the non-empty
3303  lists returned by @code{(list-tail @var{lst} @var{k})} for  lists returned by @code{(list-tail @var{lst} @var{k})} for
# Line 3169  returned. Line 3307  returned.
3307  @end deffn  @end deffn
3308    
3309  @rnindex memv  @rnindex memv
3310  @deffn primitive memv x lst  @deffn {Scheme Procedure} memv x lst
3311    @deffnx {C Function} scm_memv (x, lst)
3312  Return the first sublist of @var{lst} whose car is @code{eqv?}  Return the first sublist of @var{lst} whose car is @code{eqv?}
3313  to @var{x} where the sublists of @var{lst} are the non-empty  to @var{x} where the sublists of @var{lst} are the non-empty
3314  lists returned by @code{(list-tail @var{lst} @var{k})} for  lists returned by @code{(list-tail @var{lst} @var{k})} for
# Line 3179  returned. Line 3318  returned.
3318  @end deffn  @end deffn
3319    
3320  @rnindex member  @rnindex member
3321  @deffn primitive member x lst  @deffn {Scheme Procedure} member x lst
3322    @deffnx {C Function} scm_member (x, lst)
3323  Return the first sublist of @var{lst} whose car is  Return the first sublist of @var{lst} whose car is
3324  @code{equal?} to @var{x} where the sublists of @var{lst} are  @code{equal?} to @var{x} where the sublists of @var{lst} are
3325  the non-empty lists returned by @code{(list-tail @var{lst}  the non-empty lists returned by @code{(list-tail @var{lst}
# Line 3192  empty list) is returned. Line 3332  empty list) is returned.
3332  high level at all?  Maybe these docs should be relegated to a "Guile  high level at all?  Maybe these docs should be relegated to a "Guile
3333  Internals" node or something. -twp]  Internals" node or something. -twp]
3334    
3335  @deffn primitive sloppy-memq x lst  @deffn {Scheme Procedure} sloppy-memq x lst
3336    @deffnx {C Function} scm_sloppy_memq (x, lst)
3337  This procedure behaves like @code{memq}, but does no type or error checking.  This procedure behaves like @code{memq}, but does no type or error checking.
3338  Its use is recommended only in writing Guile internals,  Its use is recommended only in writing Guile internals,
3339  not for high-level Scheme programs.  not for high-level Scheme programs.
3340  @end deffn  @end deffn
3341    
3342  @deffn primitive sloppy-memv x lst  @deffn {Scheme Procedure} sloppy-memv x lst
3343    @deffnx {C Function} scm_sloppy_memv (x, lst)
3344  This procedure behaves like @code{memv}, but does no type or error checking.  This procedure behaves like @code{memv}, but does no type or error checking.
3345  Its use is recommended only in writing Guile internals,  Its use is recommended only in writing Guile internals,
3346  not for high-level Scheme programs.  not for high-level Scheme programs.
3347  @end deffn  @end deffn
3348    
3349  @deffn primitive sloppy-member x lst  @deffn {Scheme Procedure} sloppy-member x lst
3350    @deffnx {C Function} scm_sloppy_member (x, lst)
3351  This procedure behaves like @code{member}, but does no type or error checking.  This procedure behaves like @code{member}, but does no type or error checking.
3352  Its use is recommended only in writing Guile internals,  Its use is recommended only in writing Guile internals,
3353  not for high-level Scheme programs.  not for high-level Scheme programs.
# Line 3222  return value. Line 3365  return value.
3365    
3366  @rnindex map  @rnindex map
3367  @c begin (texi-doc-string "guile" "map")  @c begin (texi-doc-string "guile" "map")
3368  @deffn primitive map proc arg1 arg2 @dots{}  @deffn {Scheme Procedure} map proc arg1 arg2 @dots{}
3369  @deffnx primitive map-in-order proc arg1 arg2 @dots{}  @deffnx {Scheme Procedure} map-in-order proc arg1 arg2 @dots{}
3370  Apply @var{proc} to each element of the list @var{arg1} (if only two  Apply @var{proc} to each element of the list @var{arg1} (if only two
3371  arguments are given), or to the corresponding elements of the argument  arguments are given), or to the corresponding elements of the argument
3372  lists (if more than two arguments are given).  The result(s) of the  lists (if more than two arguments are given).  The result(s) of the
# Line 3235  elements. Line 3378  elements.
3378    
3379  @rnindex for-each  @rnindex for-each
3380  @c begin (texi-doc-string "guile" "for-each")  @c begin (texi-doc-string "guile" "for-each")
3381  @deffn primitive for-each proc arg1 arg2 @dots{}  @deffn {Scheme Procedure} for-each proc arg1 arg2 @dots{}
3382  Like @code{map}, but the procedure is always applied from left to right,  Like @code{map}, but the procedure is always applied from left to right,
3383  and the result(s) of the procedure applications are thrown away.  The  and the result(s) of the procedure applications are thrown away.  The
3384  return value is not specified.  return value is not specified.
# Line 3277  number in hexadecimal notation. Line 3420  number in hexadecimal notation.
3420  @subsection Vector Predicates  @subsection Vector Predicates
3421    
3422  @rnindex vector?  @rnindex vector?
3423  @deffn primitive vector? obj  @deffn {Scheme Procedure} vector? obj
3424    @deffnx {C Function} scm_vector_p (obj)
3425  Return @code{#t} if @var{obj} is a vector, otherwise return  Return @code{#t} if @var{obj} is a vector, otherwise return
3426  @code{#f}.  @code{#f}.
3427  @end deffn  @end deffn
# Line 3285  Return @code{#t} if @var{obj} is a vecto Line 3429  Return @code{#t} if @var{obj} is a vecto
3429  @subsection Vector Constructors  @subsection Vector Constructors
3430    
3431  @rnindex make-vector  @rnindex make-vector
3432  @deffn primitive make-vector k [fill]  @deffn {Scheme Procedure} make-vector k [fill]
3433    @deffnx {C Function} scm_make_vector (k, fill)
3434  Return a newly allocated vector of @var{k} elements.  If a  Return a newly allocated vector of @var{k} elements.  If a
3435  second argument is given, then each position is initialized to  second argument is given, then each position is initialized to
3436  @var{fill}.  Otherwise the initial contents of each position are  @var{fill}.  Otherwise the initial contents of each position are
# Line 3294  unspecified. Line 3439  unspecified.
3439    
3440  @rnindex vector  @rnindex vector
3441  @rnindex list->vector  @rnindex list->vector
3442  @deffn primitive vector . l  @deffn {Scheme Procedure} vector . l
3443  @deffnx primitive list->vector l  @deffnx {Scheme Procedure} list->vector l
3444    @deffnx {C Function} scm_vector (l)
3445  Return a newly allocated vector composed of the given arguments.  Return a newly allocated vector composed of the given arguments.
3446  Analogous to @code{list}.  Analogous to @code{list}.
3447    
# Line 3305  Analogous to @code{list}. Line 3451  Analogous to @code{list}.
3451  @end deffn  @end deffn
3452    
3453  @rnindex vector->list  @rnindex vector->list
3454  @deffn primitive vector->list v  @deffn {Scheme Procedure} vector->list v
3455    @deffnx {C Function} scm_vector_to_list (v)
3456  Return a newly allocated list composed of the elements of @var{v}.  Return a newly allocated list composed of the elements of @var{v}.
3457    
3458  @lisp  @lisp
# Line 3326  considered to be constant, although Guil Line 3473  considered to be constant, although Guil
3473  error.  error.
3474    
3475  @rnindex vector-set!  @rnindex vector-set!
3476  @deffn primitive vector-set! vector k obj  @deffn {Scheme Procedure} vector-set! vector k obj
3477  Store @var{obj} in position @var{k} of @var{vector}.  Store @var{obj} in position @var{k} of @var{vector}.
3478  @var{k} must be a valid index of @var{vector}.  @var{k} must be a valid index of @var{vector}.
3479  The value returned by @samp{vector-set!} is unspecified.  The value returned by @samp{vector-set!} is unspecified.
# Line 3338  The value returned by @samp{vector-set!} Line 3485  The value returned by @samp{vector-set!}
3485  @end deffn  @end deffn
3486    
3487  @rnindex vector-fill!  @rnindex vector-fill!
3488  @deffn primitive vector-fill! v fill  @deffn {Scheme Procedure} vector-fill! v fill
3489    @deffnx {C Function} scm_vector_fill_x (v, fill)
3490  Store @var{fill} in every position of @var{vector}.  The value  Store @var{fill} in every position of @var{vector}.  The value
3491  returned by @code{vector-fill!} is unspecified.  returned by @code{vector-fill!} is unspecified.
3492  @end deffn  @end deffn
3493    
3494  @deffn primitive vector-move-left! vec1 start1 end1 vec2 start2  @deffn {Scheme Procedure} vector-move-left! vec1 start1 end1 vec2 start2
3495    @deffnx {C Function} scm_vector_move_left_x (vec1, start1, end1, vec2, start2)
3496  Copy elements from @var{vec1}, positions @var{start1} to @var{end1},  Copy elements from @var{vec1}, positions @var{start1} to @var{end1},
3497  to @var{vec2} starting at position @var{start2}.  @var{start1} and  to @var{vec2} starting at position @var{start2}.  @var{start1} and
3498  @var{start2} are inclusive indices; @var{end1} is exclusive.  @var{start2} are inclusive indices; @var{end1} is exclusive.
# Line 3354  same vector, @code{vector-move-left!} is Line 3503  same vector, @code{vector-move-left!} is
3503  @var{start1} is greater than @var{start2}.  @var{start1} is greater than @var{start2}.
3504  @end deffn  @end deffn
3505    
3506  @deffn primitive vector-move-right! vec1 start1 end1 vec2 start2  @deffn {Scheme Procedure} vector-move-right! vec1 start1 end1 vec2 start2
3507    @deffnx {C Function} scm_vector_move_right_x (vec1, start1, end1, vec2, start2)
3508  Copy elements from @var{vec1}, positions @var{start1} to @var{end1},  Copy elements from @var{vec1}, positions @var{start1} to @var{end1},
3509  to @var{vec2} starting at position @var{start2}.  @var{start1} and  to @var{vec2} starting at position @var{start2}.  @var{start1} and
3510  @var{start2} are inclusive indices; @var{end1} is exclusive.  @var{start2} are inclusive indices; @var{end1} is exclusive.
# Line 3371  These procedures return information abou Line 3521  These procedures return information abou
3521  size or what elements are contained in the vector.  size or what elements are contained in the vector.
3522    
3523  @rnindex vector-length  @rnindex vector-length
3524  @deffn primitive vector-length vector  @deffn {Scheme Procedure} vector-length vector
3525  Return the number of elements in @var{vector} as an exact integer.  Return the number of elements in @var{vector} as an exact integer.
3526  @end deffn  @end deffn
3527    
3528  @rnindex vector-ref  @rnindex vector-ref
3529  @deffn primitive vector-ref vector k  @deffn {Scheme Procedure} vector-ref vector k
3530  Return the contents of position @var{k} of @var{vector}.  Return the contents of position @var{k} of @var{vector}.
3531  @var{k} must be a valid index of @var{vector}.  @var{k} must be a valid index of @var{vector}.
3532  @lisp  @lisp
# Line 3396  Return the contents of position @var{k} Line 3546  Return the contents of position @var{k}
3546  A @dfn{record type} is a first class object representing a user-defined  A @dfn{record type} is a first class object representing a user-defined
3547  data type.  A @dfn{record} is an instance of a record type.  data type.  A @dfn{record} is an instance of a record type.
3548    
3549  @deffn procedure record? obj  @deffn {Scheme Procedure} record? obj
3550  Return @code{#t} if @var{obj} is a record of any type and @code{#f}  Return @code{#t} if @var{obj} is a record of any type and @code{#f}
3551  otherwise.  otherwise.
3552    
# Line 3404  Note that @code{record?} may be true of Line 3554  Note that @code{record?} may be true of
3554  promise that records are disjoint with other Scheme types.  promise that records are disjoint with other Scheme types.
3555  @end deffn  @end deffn
3556    
3557  @deffn procedure make-record-type type-name field-names  @deffn {Scheme Procedure} make-record-type type-name field-names
3558  Return a @dfn{record-type descriptor}, a value representing a new data  Return a @dfn{record-type descriptor}, a value representing a new data
3559  type disjoint from all others.  The @var{type-name} argument must be a  type disjoint from all others.  The @var{type-name} argument must be a
3560  string, but is only used for debugging purposes (such as the printed  string, but is only used for debugging purposes (such as the printed
# Line 3414  new type.  It is an error if the list co Line 3564  new type.  It is an error if the list co
3564  unspecified how record-type descriptors are represented.  unspecified how record-type descriptors are represented.
3565  @end deffn  @end deffn
3566    
3567  @deffn procedure record-constructor rtd [field-names]  @deffn {Scheme Procedure} record-constructor rtd [field-names]
3568  Return a procedure for constructing new members of the type represented  Return a procedure for constructing new members of the type represented
3569  by @var{rtd}.  The returned procedure accepts exactly as many arguments  by @var{rtd}.  The returned procedure accepts exactly as many arguments
3570  as there are symbols in the given list, @var{field-names}; these are  as there are symbols in the given list, @var{field-names}; these are
# Line 3427  if the @var{field-names} argument is pro Line 3577  if the @var{field-names} argument is pro
3577  contains any duplicates or any symbols not in the default list.  contains any duplicates or any symbols not in the default list.
3578  @end deffn  @end deffn
3579    
3580  @deffn procedure record-predicate rtd  @deffn {Scheme Procedure} record-predicate rtd
3581  Return a procedure for testing membership in the type represented by  Return a procedure for testing membership in the type represented by
3582  @var{rtd}.  The returned procedure accepts exactly one argument and  @var{rtd}.  The returned procedure accepts exactly one argument and
3583  returns a true value if the argument is a member of the indicated record  returns a true value if the argument is a member of the indicated record
3584  type; it returns a false value otherwise.  type; it returns a false value otherwise.
3585  @end deffn  @end deffn
3586    
3587  @deffn procedure record-accessor rtd field-name  @deffn {Scheme Procedure} record-accessor rtd field-name
3588  Return a procedure for reading the value of a particular field of a  Return a procedure for reading the value of a particular field of a
3589  member of the type represented by @var{rtd}.  The returned procedure  member of the type represented by @var{rtd}.  The returned procedure
3590  accepts exactly one argument which must be a record of the appropriate  accepts exactly one argument which must be a record of the appropriate
# Line 3444  member of the list of field-names in the Line 3594  member of the list of field-names in the
3594  that created the type represented by @var{rtd}.  that created the type represented by @var{rtd}.
3595  @end deffn  @end deffn
3596    
3597  @deffn procedure record-modifier rtd field-name  @deffn {Scheme Procedure} record-modifier rtd field-name
3598  Return a procedure for writing the value of a particular field of a  Return a procedure for writing the value of a particular field of a
3599  member of the type represented by @var{rtd}.  The returned procedure  member of the type represented by @var{rtd}.  The returned procedure
3600  accepts exactly two arguments: first, a record of the appropriate type,  accepts exactly two arguments: first, a record of the appropriate type,
# Line 3456  to @code{make-record-type} that created Line 3606  to @code{make-record-type} that created
3606  @var{rtd}.  @var{rtd}.
3607  @end deffn  @end deffn
3608    
3609  @deffn procedure record-type-descriptor record  @deffn {Scheme Procedure} record-type-descriptor record
3610  Return a record-type descriptor representing the type of the given  Return a record-type descriptor representing the type of the given
3611  record.  That is, for example, if the returned descriptor were passed to  record.  That is, for example, if the returned descriptor were passed to
3612  @code{record-predicate}, the resulting predicate would return a true  @code{record-predicate}, the resulting predicate would return a true
# Line 3466  case that the returned descriptor is the Line 3616  case that the returned descriptor is the
3616  procedure that created the given record.  procedure that created the given record.
3617  @end deffn  @end deffn
3618    
3619  @deffn procedure record-type-name rtd  @deffn {Scheme Procedure} record-type-name rtd
3620  Return the type-name associated with the type represented by rtd.  The  Return the type-name associated with the type represented by rtd.  The
3621  returned value is @code{eqv?} to the @var{type-name} argument given in  returned value is @code{eqv?} to the @var{type-name} argument given in
3622  the call to @code{make-record-type} that created the type represented by  the call to @code{make-record-type} that created the type represented by
3623  @var{rtd}.  @var{rtd}.
3624  @end deffn  @end deffn
3625    
3626  @deffn procedure record-type-fields rtd  @deffn {Scheme Procedure} record-type-fields rtd
3627  Return a list of the symbols naming the fields in members of the type  Return a list of the symbols naming the fields in members of the type
3628  represented by @var{rtd}.  The returned value is @code{equal?} to the  represented by @var{rtd}.  The returned value is @code{equal?} to the
3629  field-names argument given in the call to @code{make-record-type} that  field-names argument given in the call to @code{make-record-type} that
# Line 3635  Structure layouts are represented by spe Line 3785  Structure layouts are represented by spe
3785  name is a string of type and protection codes.  To create a new  name is a string of type and protection codes.  To create a new
3786  structure layout, use this procedure:  structure layout, use this procedure:
3787    
3788  @deffn primitive make-struct-layout fields  @deffn {Scheme Procedure} make-struct-layout fields
3789    @deffnx {C Function} scm_make_struct_layout (fields)
3790  Return a new structure layout object.  Return a new structure layout object.
3791    
3792  @var{fields} must be a string made up of pairs of characters  @var{fields} must be a string made up of pairs of characters
# Line 3656  indicate that the field is a tail-array. Line 3807  indicate that the field is a tail-array.
3807  This section describes the basic procedures for creating and accessing  This section describes the basic procedures for creating and accessing
3808  structures.  structures.
3809    
3810  @deffn primitive make-struct vtable tail_array_size . init  @deffn {Scheme Procedure} make-struct vtable tail_array_size . init
3811    @deffnx {C Function} scm_make_struct (vtable, tail_array_size, init)
3812  Create a new structure.  Create a new structure.
3813    
3814  @var{type} must be a vtable structure (@pxref{Vtables}).  @var{type} must be a vtable structure (@pxref{Vtables}).
# Line 3684  more powerful. Line 3836  more powerful.
3836  For more information, see the documentation for @code{make-vtable-vtable}.  For more information, see the documentation for @code{make-vtable-vtable}.
3837  @end deffn  @end deffn
3838    
3839  @deffn primitive struct? x  @deffn {Scheme Procedure} struct? x
3840    @deffnx {C Function} scm_struct_p (x)
3841  Return @code{#t} iff @var{x} is a structure object, else  Return @code{#t} iff @var{x} is a structure object, else
3842  @code{#f}.  @code{#f}.
3843  @end deffn  @end deffn
3844    
3845    
3846  @deffn primitive struct-ref handle pos  @deffn {Scheme Procedure} struct-ref handle pos
3847  @deffnx primitive struct-set! struct n value  @deffnx {Scheme Procedure} struct-set! struct n value
3848    @deffnx {C Function} scm_struct_ref (handle, pos)
3849  Access (or modify) the @var{n}th field of @var{struct}.  Access (or modify) the @var{n}th field of @var{struct}.
3850    
3851  If the field is of type 'p', then it can be set to an arbitrary value.  If the field is of type 'p', then it can be set to an arbitrary value.
# Line 3713  which are used only internally to libgui Line 3867  which are used only internally to libgui
3867  @code{vtable-offset-user} is bound to a field number.  Vtable fields  @code{vtable-offset-user} is bound to a field number.  Vtable fields
3868  at that position or greater are user definable.  at that position or greater are user definable.
3869    
3870  @deffn primitive struct-vtable handle  @deffn {Scheme Procedure} struct-vtable handle
3871    @deffnx {C Function} scm_struct_vtable (handle)
3872  Return the vtable structure that describes the type of @var{struct}.  Return the vtable structure that describes the type of @var{struct}.
3873  @end deffn  @end deffn
3874    
3875  @deffn primitive struct-vtable? x  @deffn {Scheme Procedure} struct-vtable? x
3876    @deffnx {C Function} scm_struct_vtable_p (x)
3877  Return @code{#t} iff @var{x} is a vtable structure.  Return @code{#t} iff @var{x} is a vtable structure.
3878  @end deffn  @end deffn
3879    
# Line 3729  created by using @code{(make-struct V' . Line 3885  created by using @code{(make-struct V' .
3885  that @code{V} is an instance of the type it itself describes.  Vtable  that @code{V} is an instance of the type it itself describes.  Vtable
3886  structures of the second sort are created by this procedure:  structures of the second sort are created by this procedure:
3887    
3888  @deffn primitive make-vtable-vtable user_fields tail_array_size . init  @deffn {Scheme Procedure} make-vtable-vtable user_fields tail_array_size . init
3889    @deffnx {C Function} scm_make_vtable_vtable (user_fields, tail_array_size, init)
3890  Return a new, self-describing vtable structure.  Return a new, self-describing vtable structure.
3891    
3892  @var{user-fields} is a string describing user defined fields of the  @var{user-fields} is a string describing user defined fields of the
# Line 3788  ball @result{} #<a green ball owned by N Line 3945  ball @result{} #<a green ball owned by N
3945  @end lisp  @end lisp
3946  @end deffn  @end deffn
3947    
3948  @deffn primitive struct-vtable-name vtable  @deffn {Scheme Procedure} struct-vtable-name vtable
3949    @deffnx {C Function} scm_struct_vtable_name (vtable)
3950  Return the name of the vtable @var{vtable}.  Return the name of the vtable @var{vtable}.
3951  @end deffn  @end deffn
3952    
3953  @deffn primitive set-struct-vtable-name! vtable name  @deffn {Scheme Procedure} set-struct-vtable-name! vtable name
3954    @deffnx {C Function} scm_set_struct_vtable_name_x (vtable, name)
3955  Set the name of the vtable @var{vtable} to @var{name}.  Set the name of the vtable @var{vtable} to @var{name}.
3956  @end deffn  @end deffn
3957    
3958  @deffn primitive struct-vtable-tag handle  @deffn {Scheme Procedure} struct-vtable-tag handle
3959    @deffnx {C Function} scm_struct_vtable_tag (handle)
3960  Return the vtable tag of the structure @var{handle}.  Return the vtable tag of the structure @var{handle}.
3961  @end deffn  @end deffn
3962    
# Line 3855  a vector: Line 4015  a vector:
4015    
4016  The following procedures can be used with conventional arrays (or vectors).  The following procedures can be used with conventional arrays (or vectors).
4017    
4018  @deffn primitive array? v [prot]  @deffn {Scheme Procedure} array? v [prot]
4019    @deffnx {C Function} scm_array_p (v, prot)
4020  Return @code{#t} if the @var{obj} is an array, and @code{#f} if  Return @code{#t} if the @var{obj} is an array, and @code{#f} if
4021  not.  The @var{prototype} argument is used with uniform arrays  not.  The @var{prototype} argument is used with uniform arrays
4022  and is described elsewhere.  and is described elsewhere.
4023  @end deffn  @end deffn
4024    
4025  @deffn procedure make-array initial-value bound1 bound2 @dots{}  @deffn {Scheme Procedure} make-array initial-value bound1 bound2 @dots{}
4026  Create and return an array that has as many dimensions as there are  Create and return an array that has as many dimensions as there are
4027  @var{bound}s and fill it with @var{initial-value}.  Each @var{bound}  @var{bound}s and fill it with @var{initial-value}.  Each @var{bound}
4028  may be a positive non-zero integer @var{N}, in which case the index for  may be a positive non-zero integer @var{N}, in which case the index for
# Line 3874  same number (however, @var{lower} cannot Line 4035  same number (however, @var{lower} cannot
4035  @c array-ref's type is `compiled-closure'.  There's some weird stuff  @c array-ref's type is `compiled-closure'.  There's some weird stuff
4036  @c going on in array.c, too.  Let's call it a primitive. -twp  @c going on in array.c, too.  Let's call it a primitive. -twp
4037    
4038  @deffn primitive uniform-vector-ref v args  @deffn {Scheme Procedure} uniform-vector-ref v args
4039  @deffnx primitive array-ref v . args  @deffnx {Scheme Procedure} array-ref v . args
4040    @deffnx {C Function} scm_uniform_vector_ref (v, args)
4041  Return the element at the @code{(index1, index2)} element in  Return the element at the @code{(index1, index2)} element in
4042  @var{array}.  @var{array}.
4043  @end deffn  @end deffn
4044    
4045  @deffn primitive array-in-bounds? v . args  @deffn {Scheme Procedure} array-in-bounds? v . args
4046    @deffnx {C Function} scm_array_in_bounds_p (v, args)
4047  Return @code{#t} if its arguments would be acceptable to  Return @code{#t} if its arguments would be acceptable to
4048  @code{array-ref}.  @code{array-ref}.
4049  @end deffn  @end deffn
4050    
4051  @c fixme: why do these sigs differ?  -ttn 2001/07/19 01:14:12  @c fixme: why do these sigs differ?  -ttn 2001/07/19 01:14:12
4052  @deffn primitive array-set! v obj . args  @deffn {Scheme Procedure} array-set! v obj . args
4053  @deffnx primitive uniform-array-set1! v obj args  @deffnx {Scheme Procedure} uniform-array-set1! v obj args
4054    @deffnx {C Function} scm_array_set_x (v, obj, args)
4055  Set the element at the @code{(index1, index2)} element in @var{array} to  Set the element at the @code{(index1, index2)} element in @var{array} to
4056  @var{new-value}.  The value returned by array-set! is unspecified.  @var{new-value}.  The value returned by array-set! is unspecified.
4057  @end deffn  @end deffn
4058    
4059  @deffn primitive make-shared-array oldra mapfunc . dims  @deffn {Scheme Procedure} make-shared-array oldra mapfunc . dims
4060    @deffnx {C Function} scm_make_shared_array (oldra, mapfunc, dims)
4061  @code{make-shared-array} can be used to create shared subarrays of other  @code{make-shared-array} can be used to create shared subarrays of other
4062  arrays.  The @var{mapper} is a function that translates coordinates in  arrays.  The @var{mapper} is a function that translates coordinates in
4063  the new array into coordinates in the old array.  A @var{mapper} must be  the new array into coordinates in the old array.  A @var{mapper} must be
# Line 3910  it can be otherwise arbitrary.  A simple Line 4075  it can be otherwise arbitrary.  A simple
4075  @end lisp  @end lisp
4076  @end deffn  @end deffn
4077    
4078  @deffn primitive shared-array-increments ra  @deffn {Scheme Procedure} shared-array-increments ra
4079    @deffnx {C Function} scm_shared_array_increments (ra)
4080  For each dimension, return the distance between elements in the root vector.  For each dimension, return the distance between elements in the root vector.
4081  @end deffn  @end deffn
4082    
4083  @deffn primitive shared-array-offset ra  @deffn {Scheme Procedure} shared-array-offset ra
4084    @deffnx {C Function} scm_shared_array_offset (ra)
4085  Return the root vector index of the first element in the array.  Return the root vector index of the first element in the array.
4086  @end deffn  @end deffn
4087    
4088  @deffn primitive shared-array-root ra  @deffn {Scheme Procedure} shared-array-root ra
4089    @deffnx {C Function} scm_shared_array_root (ra)
4090  Return the root vector of a shared array.  Return the root vector of a shared array.
4091  @end deffn  @end deffn
4092    
4093  @deffn primitive transpose-array ra . args  @deffn {Scheme Procedure} transpose-array ra . args
4094    @deffnx {C Function} scm_transpose_array (ra, args)
4095  Return an array sharing contents with @var{array}, but with  Return an array sharing contents with @var{array}, but with
4096  dimensions arranged in a different order.  There must be one  dimensions arranged in a different order.  There must be one
4097  @var{dim} argument for each dimension of @var{array}.  @var{dim} argument for each dimension of @var{array}.
# Line 3944  have smaller rank than @var{array}. Line 4113  have smaller rank than @var{array}.
4113  @end lisp  @end lisp
4114  @end deffn  @end deffn
4115    
4116  @deffn primitive enclose-array ra . axes  @deffn {Scheme Procedure} enclose-array ra . axes
4117    @deffnx {C Function} scm_enclose_array (ra, axes)
4118  @var{dim0}, @var{dim1} @dots{} should be nonnegative integers less than  @var{dim0}, @var{dim1} @dots{} should be nonnegative integers less than
4119  the rank of @var{array}.  @var{enclose-array} returns an array  the rank of @var{array}.  @var{enclose-array} returns an array
4120  resembling an array of shared arrays.  The dimensions of each shared  resembling an array of shared arrays.  The dimensions of each shared
# Line 3968  examples: Line 4138  examples:
4138  @end lisp  @end lisp
4139  @end deffn  @end deffn
4140    
4141  @deffn procedure array-shape array  @deffn {Scheme Procedure} array-shape array
4142  Return a list of inclusive bounds of integers.  Return a list of inclusive bounds of integers.
4143  @example  @example
4144  (array-shape (make-array 'foo '(-1 3) 5)) @result{} ((-1 3) (0 4))  (array-shape (make-array 'foo '(-1 3) 5)) @result{} ((-1 3) (0 4))
4145  @end example  @end example
4146  @end deffn  @end deffn
4147    
4148  @deffn primitive array-dimensions ra  @deffn {Scheme Procedure} array-dimensions ra
4149    @deffnx {C Function} scm_array_dimensions (ra)
4150  @code{Array-dimensions} is similar to @code{array-shape} but replaces  @code{Array-dimensions} is similar to @code{array-shape} but replaces
4151  elements with a @code{0} minimum with one greater than the maximum. So:  elements with a @code{0} minimum with one greater than the maximum. So:
4152  @lisp  @lisp
# Line 3983  elements with a @code{0} minimum with on Line 4154  elements with a @code{0} minimum with on
4154  @end lisp  @end lisp
4155  @end deffn  @end deffn
4156    
4157  @deffn primitive array-rank ra  @deffn {Scheme Procedure} array-rank ra
4158    @deffnx {C Function} scm_array_rank (ra)
4159  Return the number of dimensions of @var{obj}.  If @var{obj} is  Return the number of dimensions of @var{obj}.  If @var{obj} is
4160  not an array, @code{0} is returned.  not an array, @code{0} is returned.
4161  @end deffn  @end deffn
4162    
4163  @deffn primitive array->list v  @deffn {Scheme Procedure} array->list v
4164    @deffnx {C Function} scm_array_to_list (v)
4165  Return a list consisting of all the elements, in order, of  Return a list consisting of all the elements, in order, of
4166  @var{array}.  @var{array}.
4167  @end deffn  @end deffn
4168    
4169  @deffn primitive array-copy! src dst  @deffn {Scheme Procedure} array-copy! src dst
4170  @deffnx primitive array-copy-in-order! src dst  @deffnx {Scheme Procedure} array-copy-in-order! src dst
4171    @deffnx {C Function} scm_array_copy_x (src, dst)
4172  Copy every element from vector or array @var{source} to the  Copy every element from vector or array @var{source} to the
4173  corresponding element of @var{destination}.  @var{destination} must have  corresponding element of @var{destination}.  @var{destination} must have
4174  the same rank as @var{source}, and be at least as large in each  the same rank as @var{source}, and be at least as large in each
4175  dimension.  The order is unspecified.  dimension.  The order is unspecified.
4176  @end deffn  @end deffn
4177    
4178  @deffn primitive array-fill! ra fill  @deffn {Scheme Procedure} array-fill! ra fill
4179    @deffnx {C Function} scm_array_fill_x (ra, fill)
4180  Store @var{fill} in every element of @var{array}.  The value returned  Store @var{fill} in every element of @var{array}.  The value returned
4181  is unspecified.  is unspecified.
4182  @end deffn  @end deffn
4183    
4184  @c begin (texi-doc-string "guile" "array-equal?")  @c begin (texi-doc-string "guile" "array-equal?")
4185  @deffn primitive array-equal? ra0 ra1  @deffn {Scheme Procedure} array-equal? ra0 ra1
4186  Return @code{#t} iff all arguments are arrays with the same shape, the  Return @code{#t} iff all arguments are arrays with the same shape, the
4187  same type, and have corresponding elements which are either  same type, and have corresponding elements which are either
4188  @code{equal?}  or @code{array-equal?}.  This function differs from  @code{equal?}  or @code{array-equal?}.  This function differs from
# Line 4015  same type, and have corresponding elemen Line 4190  same type, and have corresponding elemen
4190  @var{array-equal?} but not @var{equal?} to a vector or uniform vector.  @var{array-equal?} but not @var{equal?} to a vector or uniform vector.
4191  @end deffn  @end deffn
4192    
4193  @deffn primitive array-contents ra [strict]  @deffn {Scheme Procedure} array-contents ra [strict]
4194  @deffnx primitive array-contents array strict  @deffnx {Scheme Procedure} array-contents array strict
4195    @deffnx {C Function} scm_array_contents (ra, strict)
4196  If @var{array} may be @dfn{unrolled} into a one dimensional shared array  If @var{array} may be @dfn{unrolled} into a one dimensional shared array
4197  without changing their order (last subscript changing fastest), then  without changing their order (last subscript changing fastest), then
4198  @code{array-contents} return that shared array, otherwise return  @code{array-contents} returns that shared array, otherwise it returns
4199  @code{#f}.  All arrays made by @var{make-array} and  @code{#f}.  All arrays made by @var{make-array} and
4200  @var{make-uniform-array} may be unrolled, some arrays made by  @var{make-uniform-array} may be unrolled, some arrays made by
4201  @var{make-shared-array} may not be.  @var{make-shared-array} may not be.
# Line 4032  memory. Line 4208  memory.
4208  @node Array Mapping  @node Array Mapping
4209  @subsection Array Mapping  @subsection Array Mapping
4210    
4211  @deffn primitive array-map! ra0 proc . lra  @deffn {Scheme Procedure} array-map! ra0 proc . lra
4212  @deffnx primitive array-map-in-order! ra0 proc . lra  @deffnx {Scheme Procedure} array-map-in-order! ra0 proc . lra
4213    @deffnx {C Function} scm_array_map_x (ra0, proc, lra)
4214  @var{array1}, @dots{} must have the same number of dimensions as  @var{array1}, @dots{} must have the same number of dimensions as
4215  @var{array0} and have a range for each index which includes the range  @var{array0} and have a range for each index which includes the range
4216  for the corresponding index in @var{array0}.  @var{proc} is applied to  for the corresponding index in @var{array0}.  @var{proc} is applied to
# Line 4042  as the corresponding element in @var{arr Line 4219  as the corresponding element in @var{arr
4219  unspecified.  The order of application is unspecified.  unspecified.  The order of application is unspecified.
4220  @end deffn  @end deffn
4221    
4222  @deffn primitive array-for-each proc ra0 . lra  @deffn {Scheme Procedure} array-for-each proc ra0 . lra
4223    @deffnx {C Function} scm_array_for_each (proc, ra0, lra)
4224  Apply @var{proc} to each tuple of elements of @var{array0} @dots{}  Apply @var{proc} to each tuple of elements of @var{array0} @dots{}
4225  in row-major order.  The value returned is unspecified.  in row-major order.  The value returned is unspecified.
4226  @end deffn  @end deffn
4227    
4228  @deffn primitive array-index-map! ra proc  @deffn {Scheme Procedure} array-index-map! ra proc
4229    @deffnx {C Function} scm_array_index_map_x (ra, proc)
4230  Apply @var{proc} to the indices of each element of @var{array} in  Apply @var{proc} to the indices of each element of @var{array} in
4231  turn, storing the result in the corresponding element.  The value  turn, storing the result in the corresponding element.  The value
4232  returned and the order of application are unspecified.  returned and the order of application are unspecified.
# Line 4125  except that a single character from the Line 4304  except that a single character from the
4304  @code{#} and @code{(}.  For example, a uniform vector of signed  @code{#} and @code{(}.  For example, a uniform vector of signed
4305  long integers is displayed in the form @code{'#e(3 5 9)}.  long integers is displayed in the form @code{'#e(3 5 9)}.
4306    
4307  @deffn primitive array? v [prot]  @deffn {Scheme Procedure} array? v [prot]
4308  Return @code{#t} if the @var{obj} is an array, and @code{#f} if not.  Return @code{#t} if the @var{obj} is an array, and @code{#f} if not.
4309    
4310  The @var{prototype} argument is used with uniform arrays and is described  The @var{prototype} argument is used with uniform arrays and is described
4311  elsewhere.  elsewhere.
4312  @end deffn  @end deffn
4313    
4314  @deffn procedure make-uniform-array prototype bound1 bound2 @dots{}  @deffn {Scheme Procedure} make-uniform-array prototype bound1 bound2 @dots{}
4315  Create and return a uniform array of type corresponding to  Create and return a uniform array of type corresponding to
4316  @var{prototype} that has as many dimensions as there are @var{bound}s  @var{prototype} that has as many dimensions as there are @var{bound}s
4317  and fill it with @var{prototype}.  and fill it with @var{prototype}.
4318  @end deffn  @end deffn
4319    
4320  @deffn primitive array-prototype ra  @deffn {Scheme Procedure} array-prototype ra
4321    @deffnx {C Function} scm_array_prototype (ra)
4322  Return an object that would produce an array of the same type  Return an object that would produce an array of the same type
4323  as @var{array}, if used as the @var{prototype} for  as @var{array}, if used as the @var{prototype} for
4324  @code{make-uniform-array}.  @code{make-uniform-array}.
4325  @end deffn  @end deffn
4326    
4327  @deffn primitive list->uniform-array ndim prot lst  @deffn {Scheme Procedure} list->uniform-array ndim prot lst
4328  @deffnx procedure list->uniform-vector prot lst  @deffnx {Scheme Procedure} list->uniform-vector prot lst
4329    @deffnx {C Function} scm_list_to_uniform_array (ndim, prot, lst)
4330  Return a uniform array of the type indicated by prototype  Return a uniform array of the type indicated by prototype
4331  @var{prot} with elements the same as those of @var{lst}.  @var{prot} with elements the same as those of @var{lst}.
4332  Elements must be of the appropriate type, no coercions are  Elements must be of the appropriate type, no coercions are
4333  done.  done.
4334  @end deffn  @end deffn
4335    
4336  @deffn primitive uniform-vector-fill! uve fill  @deffn {Scheme Procedure} uniform-vector-fill! uve fill
4337  Store @var{fill} in every element of @var{uve}.  The value returned is  Store @var{fill} in every element of @var{uve}.  The value returned is
4338  unspecified.  unspecified.
4339  @end deffn  @end deffn
4340    
4341  @deffn primitive uniform-vector-length v  @deffn {Scheme Procedure} uniform-vector-length v
4342    @deffnx {C Function} scm_uniform_vector_length (v)
4343  Return the number of elements in @var{uve}.  Return the number of elements in @var{uve}.
4344  @end deffn  @end deffn
4345    
4346  @deffn primitive dimensions->uniform-array dims prot [fill]  @deffn {Scheme Procedure} dimensions->uniform-array dims prot [fill]
4347  @deffnx primitive make-uniform-vector length prototype [fill]  @deffnx {Scheme Procedure} make-uniform-vector length prototype [fill]
4348    @deffnx {C Function} scm_dimensions_to_uniform_array (dims, prot, fill)
4349  Create and return a uniform array or vector of type  Create and return a uniform array or vector of type
4350  corresponding to @var{prototype} with dimensions @var{dims} or  corresponding to @var{prototype} with dimensions @var{dims} or
4351  length @var{length}.  If @var{fill} is supplied, it's used to  length @var{length}.  If @var{fill} is supplied, it's used to
# Line 4171  fill the array, otherwise @var{prototype Line 4354  fill the array, otherwise @var{prototype
4354    
4355  @c Another compiled-closure. -twp  @c Another compiled-closure. -twp
4356    
4357  @deffn primitive uniform-array-read! ra [port_or_fd [start [end]]]  @deffn {Scheme Procedure} uniform-array-read! ra [port_or_fd [start [end]]]
4358  @deffnx primitive uniform-vector-read! uve [port-or-fdes] [start] [end]  @deffnx {Scheme Procedure} uniform-vector-read! uve [port-or-fdes] [start] [end]
4359    @deffnx {C Function} scm_uniform_array_read_x (ra, port_or_fd, start, end)
4360  Attempt to read all elements of @var{ura}, in lexicographic order, as  Attempt to read all elements of @var{ura}, in lexicographic order, as
4361  binary objects from @var{port-or-fdes}.  binary objects from @var{port-or-fdes}.
4362  If an end of file is encountered during  If an end of file is encountered during
# Line 4189  leaving the remainder of the vector unch Line 4373  leaving the remainder of the vector unch
4373  returned by @code{(current-input-port)}.  returned by @code{(current-input-port)}.
4374  @end deffn  @end deffn
4375    
4376  @deffn primitive uniform-array-write v [port_or_fd [start [end]]]  @deffn {Scheme Procedure} uniform-array-write v [port_or_fd [start [end]]]
4377  @deffnx primitive uniform-vector-write uve [port-or-fdes] [start] [end]  @deffnx {Scheme Procedure} uniform-vector-write uve [port-or-fdes] [start] [end]
4378    @deffnx {C Function} scm_uniform_array_write (v, port_or_fd, start, end)
4379  Writes all elements of @var{ura} as binary objects to  Writes all elements of @var{ura} as binary objects to
4380  @var{port-or-fdes}.  @var{port-or-fdes}.
4381    
# Line 4223  They are displayed as a sequence of @cod Line 4408  They are displayed as a sequence of @cod
4408  #*101  #*101
4409  @end example  @end example
4410    
4411  @deffn primitive bit-count b bitvector  @deffn {Scheme Procedure} bit-count b bitvector
4412    @deffnx {C Function} scm_bit_count (b, bitvector)
4413  Return the number of occurrences of the boolean @var{b} in  Return the number of occurrences of the boolean @var{b} in
4414  @var{bitvector}.  @var{bitvector}.
4415  @end deffn  @end deffn
4416    
4417  @deffn primitive bit-position item v k  @deffn {Scheme Procedure} bit-position item v k
4418    @deffnx {C Function} scm_bit_position (item, v, k)
4419  Return the minimum index of an occurrence of @var{bool} in  Return the minimum index of an occurrence of @var{bool} in
4420  @var{bv} which is at least @var{k}.  If no @var{bool} occurs  @var{bv} which is at least @var{k}.  If no @var{bool} occurs
4421  within the specified range @code{#f} is returned.  within the specified range @code{#f} is returned.
4422  @end deffn  @end deffn
4423    
4424  @deffn primitive bit-invert! v  @deffn {Scheme Procedure} bit-invert! v
4425    @deffnx {C Function} scm_bit_invert_x (v)
4426  Modify @var{bv} by replacing each element with its negation.  Modify @var{bv} by replacing each element with its negation.
4427  @end deffn  @end deffn
4428    
4429  @deffn primitive bit-set*! v kv obj  @deffn {Scheme Procedure} bit-set*! v kv obj
4430    @deffnx {C Function} scm_bit_set_star_x (v, kv, obj)
4431  If uve is a bit-vector @var{bv} and uve must be of the same  If uve is a bit-vector @var{bv} and uve must be of the same
4432  length.  If @var{bool} is @code{#t}, uve is OR'ed into  length.  If @var{bool} is @code{#t}, uve is OR'ed into
4433  @var{bv}; If @var{bool} is @code{#f}, the inversion of uve is  @var{bv}; If @var{bool} is @code{#f}, the inversion of uve is
# Line 4250  of @var{bv} corresponding to the indexes Line 4439  of @var{bv} corresponding to the indexes
4439  @var{bool}.  The return value is unspecified.  @var{bool}.  The return value is unspecified.
4440  @end deffn  @end deffn
4441    
4442  @deffn primitive bit-count* v kv obj  @deffn {Scheme Procedure} bit-count* v kv obj
4443    @deffnx {C Function} scm_bit_count_star (v, kv, obj)
4444  Return  Return
4445  @lisp  @lisp
4446  (bit-count (bit-set*! (if bool bv (bit-invert! bv)) uve #t) #t).  (bit-count (bit-set*! (if bool bv (bit-invert! bv)) uve #t) #t).
# Line 4479  independent from the list that results f Line 4669  independent from the list that results f
4669  use @code{list-copy} to copy the old association list before modifying  use @code{list-copy} to copy the old association list before modifying
4670  it.  it.
4671    
4672  @deffn primitive acons key value alist  @deffn {Scheme Procedure} acons key value alist
4673    @deffnx {C Function} scm_acons (key, value, alist)
4674  Add a new key-value pair to @var{alist}.  A new pair is  Add a new key-value pair to @var{alist}.  A new pair is
4675  created whose car is @var{key} and whose cdr is @var{value}, and the  created whose car is @var{key} and whose cdr is @var{value}, and the
4676  pair is consed onto @var{alist}, and the new list is returned.  This  pair is consed onto @var{alist}, and the new list is returned.  This
4677  function is @emph{not} destructive; @var{alist} is not modified.  function is @emph{not} destructive; @var{alist} is not modified.
4678  @end deffn  @end deffn
4679    
4680  @deffn primitive assq-set! alist key val  @deffn {Scheme Procedure} assq-set! alist key val
4681  @deffnx primitive assv-set! alist key value  @deffnx {Scheme Procedure} assv-set! alist key value
4682  @deffnx primitive assoc-set! alist key value  @deffnx {Scheme Procedure} assoc-set! alist key value
4683    @deffnx {C Function} scm_assq_set_x (alist, key, val)
4684  Reassociate @var{key} in @var{alist} with @var{value}: find any existing  Reassociate @var{key} in @var{alist} with @var{value}: find any existing
4685  @var{alist} entry for @var{key} and associate it with the new  @var{alist} entry for @var{key} and associate it with the new
4686  @var{value}.  If @var{alist} does not contain an entry for @var{key},  @var{value}.  If @var{alist} does not contain an entry for @var{key},
# Line 4511  arguments and return the entry for that Line 4703  arguments and return the entry for that
4703  where an entry exists, these procedures return the complete entry, that  where an entry exists, these procedures return the complete entry, that
4704  is @code{(KEY . VALUE)}, not just the value.  is @code{(KEY . VALUE)}, not just the value.
4705    
4706  @deffn primitive assq key alist  @deffn {Scheme Procedure} assq key alist
4707  @deffnx primitive assv key alist  @deffnx {Scheme Procedure} assv key alist
4708  @deffnx primitive assoc key alist  @deffnx {Scheme Procedure} assoc key alist
4709    @deffnx {C Function} scm_assq (key, alist)
4710    @deffnx {C Function} scm_assv (key, alist)
4711    @deffnx {C Function} scm_assoc (key, alist)
4712  Fetch the entry in @var{alist} that is associated with @var{key}.  To  Fetch the entry in @var{alist} that is associated with @var{key}.  To
4713  decide whether the argument @var{key} matches a particular entry in  decide whether the argument @var{key} matches a particular entry in
4714  @var{alist}, @code{assq} compares keys with @code{eq?}, @code{assv}  @var{alist}, @code{assq} compares keys with @code{eq?}, @code{assv}
# Line 4535  Consequently, @code{assq-ref} and friend Line 4730  Consequently, @code{assq-ref} and friend
4730  is known that an entry exists, or where the ambiguity doesn't matter  is known that an entry exists, or where the ambiguity doesn't matter
4731  for some other reason.  for some other reason.
4732    
4733  @deffn primitive assq-ref alist key  @deffn {Scheme Procedure} assq-ref alist key
4734  @deffnx primitive assv-ref alist key  @deffnx {Scheme Procedure} assv-ref alist key
4735  @deffnx primitive assoc-ref alist key  @deffnx {Scheme Procedure} assoc-ref alist key
4736    @deffnx {C Function} scm_assq_ref (alist, key)
4737  Like @code{assq}, @code{assv} and @code{assoc}, except that only the  Like @code{assq}, @code{assv} and @code{assoc}, except that only the
4738  value associated with @var{key} in @var{alist} is returned.  These  value associated with @var{key} in @var{alist} is returned.  These
4739  functions are equivalent to  functions are equivalent to
# Line 4608  two distinct entries to @code{address-li Line 4804  two distinct entries to @code{address-li
4804  after removing the first matching entry that it finds, and so one of the  after removing the first matching entry that it finds, and so one of the
4805  "mary" entries is left in place.  "mary" entries is left in place.
4806    
4807  @deffn primitive assq-remove! alist key  @deffn {Scheme Procedure} assq-remove! alist key
4808  @deffnx primitive assv-remove! alist key  @deffnx {Scheme Procedure} assv-remove! alist key
4809  @deffnx primitive assoc-remove! alist key  @deffnx {Scheme Procedure} assoc-remove! alist key
4810    @deffnx {C Function} scm_assq_remove_x (alist, key)
4811  Delete the first entry in @var{alist} associated with @var{key}, and return  Delete the first entry in @var{alist} associated with @var{key}, and return
4812  the resulting alist.  the resulting alist.
4813  @end deffn  @end deffn
# Line 4660  it is much safer to use the non-@code{sl Line 4857  it is much safer to use the non-@code{sl
4857  help to highlight coding and data errors that the @code{sloppy-}  help to highlight coding and data errors that the @code{sloppy-}
4858  versions would silently cover up.  versions would silently cover up.
4859    
4860  @deffn primitive sloppy-assq key alist  @deffn {Scheme Procedure} sloppy-assq key alist
4861    @deffnx {C Function} scm_sloppy_assq (key, alist)
4862  Behaves like @code{assq} but does not do any error checking.  Behaves like @code{assq} but does not do any error checking.
4863  Recommended only for use in Guile internals.  Recommended only for use in Guile internals.
4864  @end deffn  @end deffn
4865    
4866  @deffn primitive sloppy-assv key alist  @deffn {Scheme Procedure} sloppy-assv key alist
4867    @deffnx {C Function} scm_sloppy_assv (key, alist)
4868  Behaves like @code{assv} but does not do any error checking.  Behaves like @code{assv} but does not do any error checking.
4869  Recommended only for use in Guile internals.  Recommended only for use in Guile internals.
4870  @end deffn  @end deffn
4871    
4872  @deffn primitive sloppy-assoc key alist  @deffn {Scheme Procedure} sloppy-assoc key alist
4873    @deffnx {C Function} scm_sloppy_assoc (key, alist)
4874  Behaves like @code{assoc} but does not do any error checking.  Behaves like @code{assoc} but does not do any error checking.
4875  Recommended only for use in Guile internals.  Recommended only for use in Guile internals.
4876  @end deffn  @end deffn
# Line 4822  In each of the functions that follow, th Line 5022  In each of the functions that follow, th
5022  must be a vector.  The @var{key} and @var{value} arguments may be  must be a vector.  The @var{key} and @var{value} arguments may be
5023  any Scheme object.  any Scheme object.
5024    
5025  @deffn procedure make-hash-table size  @deffn {Scheme Procedure} make-hash-table size
5026  Create a new hash table of @var{size} slots.  Note that the number of  Create a new hash table of @var{size} slots.  Note that the number of
5027  slots does not limit the size of the table, it just tells how large  slots does not limit the size of the table, it just tells how large
5028  the underlying vector will be.  The @var{size} should be similar to  the underlying vector will be.  The @var{size} should be similar to
# Line 4831  they need not match.  For good performan Line 5031  they need not match.  For good performan
5031  use a prime number as the @var{size}.  use a prime number as the @var{size}.
5032  @end deffn  @end deffn
5033    
5034  @deffn primitive hashq-ref table key [dflt]  @deffn {Scheme Procedure} hashq-ref table key [dflt]
5035    @deffnx {C Function} scm_hashq_ref (table, key, dflt)
5036  Look up @var{key} in the hash table @var{table}, and return the  Look up @var{key} in the hash table @var{table}, and return the
5037  value (if any) associated with it.  If @var{key} is not found,  value (if any) associated with it.  If @var{key} is not found,
5038  return @var{default} (or @code{#f} if no @var{default} argument  return @var{default} (or @code{#f} if no @var{default} argument
5039  is supplied).  Uses @code{eq?} for equality testing.  is supplied).  Uses @code{eq?} for equality testing.
5040  @end deffn  @end deffn
5041    
5042  @deffn primitive hashv-ref table key [dflt]  @deffn {Scheme Procedure} hashv-ref table key [dflt]
5043    @deffnx {C Function} scm_hashv_ref (table, key, dflt)
5044  Look up @var{key} in the hash table @var{table}, and return the  Look up @var{key} in the hash table @var{table}, and return the
5045  value (if any) associated with it.  If @var{key} is not found,  value (if any) associated with it.  If @var{key} is not found,
5046  return @var{default} (or @code{#f} if no @var{default} argument  return @var{default} (or @code{#f} if no @var{default} argument
5047  is supplied).  Uses @code{eqv?} for equality testing.  is supplied).  Uses @code{eqv?} for equality testing.
5048  @end deffn  @end deffn
5049    
5050  @deffn primitive hash-ref table key [dflt]  @deffn {Scheme Procedure} hash-ref table key [dflt]
5051    @deffnx {C Function} scm_hash_ref (table, key, dflt)
5052  Look up @var{key} in the hash table @var{table}, and return the  Look up @var{key} in the hash table @var{table}, and return the
5053  value (if any) associated with it.  If @var{key} is not found,  value (if any) associated with it.  If @var{key} is not found,
5054  return @var{default} (or @code{#f} if no @var{default} argument  return @var{default} (or @code{#f} if no @var{default} argument
5055  is supplied).  Uses @code{equal?} for equality testing.  is supplied).  Uses @code{equal?} for equality testing.
5056  @end deffn  @end deffn
5057    
5058  @deffn primitive hashq-set! table key val  @deffn {Scheme Procedure} hashq-set! table key val
5059    @deffnx {C Function} scm_hashq_set_x (table, key, val)
5060  Find the entry in @var{table} associated with @var{key}, and  Find the entry in @var{table} associated with @var{key}, and
5061  store @var{value} there. Uses @code{eq?} for equality testing.  store @var{value} there. Uses @code{eq?} for equality testing.
5062  @end deffn  @end deffn
5063    
5064  @deffn primitive hashv-set! table key val  @deffn {Scheme Procedure} hashv-set! table key val
5065    @deffnx {C Function} scm_hashv_set_x (table, key, val)
5066  Find the entry in @var{table} associated with @var{key}, and  Find the entry in @var{table} associated with @var{key}, and
5067  store @var{value} there. Uses @code{eqv?} for equality testing.  store @var{value} there. Uses @code{eqv?} for equality testing.
5068  @end deffn  @end deffn
5069    
5070  @deffn primitive hash-set! table key val  @deffn {Scheme Procedure} hash-set! table key val
5071    @deffnx {C Function} scm_hash_set_x (table, key, val)
5072  Find the entry in @var{table} associated with @var{key}, and  Find the entry in @var{table} associated with @var{key}, and
5073  store @var{value} there. Uses @code{equal?} for equality  store @var{value} there. Uses @code{equal?} for equality
5074  testing.  testing.
5075  @end deffn  @end deffn
5076    
5077  @deffn primitive hashq-remove! table key  @deffn {Scheme Procedure} hashq-remove! table key
5078    @deffnx {C Function} scm_hashq_remove_x (table, key)
5079  Remove @var{key} (and any value associated with it) from  Remove @var{key} (and any value associated with it) from
5080  @var{table}.  Uses @code{eq?} for equality tests.  @var{table}.  Uses @code{eq?} for equality tests.
5081  @end deffn  @end deffn
5082    
5083  @deffn primitive hashv-remove! table key  @deffn {Scheme Procedure} hashv-remove! table key
5084    @deffnx {C Function} scm_hashv_remove_x (table, key)
5085  Remove @var{key} (and any value associated with it) from  Remove @var{key} (and any value associated with it) from
5086  @var{table}.  Uses @code{eqv?} for equality tests.  @var{table}.  Uses @code{eqv?} for equality tests.
5087  @end deffn  @end deffn
5088    
5089  @deffn primitive hash-remove! table key  @deffn {Scheme Procedure} hash-remove! table key
5090    @deffnx {C Function} scm_hash_remove_x (table, key)
5091  Remove @var{key} (and any value associated with it) from  Remove @var{key} (and any value associated with it) from
5092  @var{table}.  Uses @code{equal?} for equality tests.  @var{table}.  Uses @code{equal?} for equality tests.
5093  @end deffn  @end deffn
# Line 4898  use comfortably.  If you are interested Line 5107  use comfortably.  If you are interested
5107  introductory textbook on data structures or algorithms for an  introductory textbook on data structures or algorithms for an
5108  explanation of how hash tables are implemented.  explanation of how hash tables are implemented.
5109    
5110  @deffn primitive hashq key size  @deffn {Scheme Procedure} hashq key size
5111    @deffnx {C Function} scm_hashq (key, size)
5112  Determine a hash value for @var{key} that is suitable for  Determine a hash value for @var{key} that is suitable for
5113  lookups in a hashtable of size @var{size}, where @code{eq?} is  lookups in a hashtable of size @var{size}, where @code{eq?} is
5114  used as the equality predicate.  The function returns an  used as the equality predicate.  The function returns an
# Line 4911  in between.  This can happen, for exampl Line 5121  in between.  This can happen, for exampl
5121  different values, since @code{foo} will be garbage collected.  different values, since @code{foo} will be garbage collected.
5122  @end deffn  @end deffn
5123    
5124  @deffn primitive hashv key size  @deffn {Scheme Procedure} hashv key size
5125    @deffnx {C Function} scm_hashv (key, size)
5126  Determine a hash value for @var{key} that is suitable for  Determine a hash value for @var{key} that is suitable for
5127  lookups in a hashtable of size @var{size}, where @code{eqv?} is  lookups in a hashtable of size @var{size}, where @code{eqv?} is
5128  used as the equality predicate.  The function returns an  used as the equality predicate.  The function returns an
# Line 4924  in between.  This can happen, for exampl Line 5135  in between.  This can happen, for exampl
5135  different values, since @code{foo} will be garbage collected.  different values, since @code{foo} will be garbage collected.
5136  @end deffn  @end deffn
5137    
5138  @deffn primitive hash key size  @deffn {Scheme Procedure} hash key size
5139    @deffnx {C Function} scm_hash (key, size)
5140  Determine a hash value for @var{key} that is suitable for  Determine a hash value for @var{key} that is suitable for
5141  lookups in a hashtable of size @var{size}, where @code{equal?}  lookups in a hashtable of size @var{size}, where @code{equal?}
5142  is used as the equality predicate.  The function returns an  is used as the equality predicate.  The function returns an
5143  integer in the range 0 to @var{size} - 1.  integer in the range 0 to @var{size} - 1.
5144  @end deffn  @end deffn
5145    
5146  @deffn primitive hashx-ref hash assoc table key [dflt]  @deffn {Scheme Procedure} hashx-ref hash assoc table key [dflt]
5147    @deffnx {C Function} scm_hashx_ref (hash, assoc, table, key, dflt)
5148  This behaves the same way as the corresponding @code{ref}  This behaves the same way as the corresponding @code{ref}
5149  function, but uses @var{hash} as a hash function and  function, but uses @var{hash} as a hash function and
5150  @var{assoc} to compare keys.  @code{hash} must be a function  @var{assoc} to compare keys.  @code{hash} must be a function
# Line 4943  By way of illustration, @code{hashq-ref Line 5156  By way of illustration, @code{hashq-ref
5156  equivalent to @code{hashx-ref hashq assq table key}.  equivalent to @code{hashx-ref hashq assq table key}.
5157  @end deffn  @end deffn
5158    
5159  @deffn primitive hashx-set! hash assoc table key val  @deffn {Scheme Procedure} hashx-set! hash assoc table key val
5160    @deffnx {C Function} scm_hashx_set_x (hash, assoc, table, key, val)
5161  This behaves the same way as the corresponding @code{set!}  This behaves the same way as the corresponding @code{set!}
5162  function, but uses @var{hash} as a hash function and  function, but uses @var{hash} as a hash function and
5163  @var{assoc} to compare keys.  @code{hash} must be a function  @var{assoc} to compare keys.  @code{hash} must be a function
# Line 4955  that takes two arguments, a key to be ha Line 5169  that takes two arguments, a key to be ha
5169  equivalent to @code{hashx-set!  hashq assq table key}.  equivalent to @code{hashx-set!  hashq assq table key}.
5170  @end deffn  @end deffn
5171    
5172  @deffn primitive hashq-get-handle table key  @deffn {Scheme Procedure} hashq-get-handle table key
5173    @deffnx {C Function} scm_hashq_get_handle (table, key)
5174  This procedure returns the @code{(key . value)} pair from the  This procedure returns the @code{(key . value)} pair from the
5175  hash table @var{table}.  If @var{table} does not hold an  hash table @var{table}.  If @var{table} does not hold an
5176  associated value for @var{key}, @code{#f} is returned.  associated value for @var{key}, @code{#f} is returned.
5177  Uses @code{eq?} for equality testing.  Uses @code{eq?} for equality testing.
5178  @end deffn  @end deffn
5179    
5180  @deffn primitive hashv-get-handle table key  @deffn {Scheme Procedure} hashv-get-handle table key
5181    @deffnx {C Function} scm_hashv_get_handle (table, key)
5182  This procedure returns the @code{(key . value)} pair from the  This procedure returns the @code{(key . value)} pair from the
5183  hash table @var{table}.  If @var{table} does not hold an  hash table @var{table}.  If @var{table} does not hold an
5184  associated value for @var{key}, @code{#f} is returned.  associated value for @var{key}, @code{#f} is returned.
5185  Uses @code{eqv?} for equality testing.  Uses @code{eqv?} for equality testing.
5186  @end deffn  @end deffn
5187    
5188  @deffn primitive hash-get-handle table key  @deffn {Scheme Procedure} hash-get-handle table key
5189    @deffnx {C Function} scm_hash_get_handle (table, key)
5190  This procedure returns the @code{(key . value)} pair from the  This procedure returns the @code{(key . value)} pair from the
5191  hash table @var{table}.  If @var{table} does not hold an  hash table @var{table}.  If @var{table} does not hold an
5192  associated value for @var{key}, @code{#f} is returned.  associated value for @var{key}, @code{#f} is returned.
5193  Uses @code{equal?} for equality testing.  Uses @code{equal?} for equality testing.
5194  @end deffn  @end deffn
5195    
5196  @deffn primitive hashx-get-handle hash assoc table key  @deffn {Scheme Procedure} hashx-get-handle hash assoc table key
5197    @deffnx {C Function} scm_hashx_get_handle (hash, assoc, table, key)
5198  This behaves the same way as the corresponding  This behaves the same way as the corresponding
5199  @code{-get-handle} function, but uses @var{hash} as a hash  @code{-get-handle} function, but uses @var{hash} as a hash
5200  function and @var{assoc} to compare keys.  @code{hash} must be  function and @var{assoc} to compare keys.  @code{hash} must be
# Line 4985  table size.  @code{assoc} must be an ass Line 5203  table size.  @code{assoc} must be an ass
5203  @code{assoc}, @code{assq} or @code{assv}.  @code{assoc}, @code{assq} or @code{assv}.
5204  @end deffn  @end deffn
5205    
5206  @deffn primitive hashq-create-handle! table key init  @deffn {Scheme Procedure} hashq-create-handle! table key init
5207    @deffnx {C Function} scm_hashq_create_handle_x (table, key, init)
5208  This function looks up @var{key} in @var{table} and returns its handle.  This function looks up @var{key} in @var{table} and returns its handle.
5209  If @var{key} is not already present, a new handle is created which  If @var{key} is not already present, a new handle is created which
5210  associates @var{key} with @var{init}.  associates @var{key} with @var{init}.
5211  @end deffn  @end deffn
5212    
5213  @deffn primitive hashv-create-handle! table key init  @deffn {Scheme Procedure} hashv-create-handle! table key init
5214    @deffnx {C Function} scm_hashv_create_handle_x (table, key, init)
5215  This function looks up @var{key} in @var{table} and returns its handle.  This function looks up @var{key} in @var{table} and returns its handle.
5216  If @var{key} is not already present, a new handle is created which  If @var{key} is not already present, a new handle is created which
5217  associates @var{key} with @var{init}.  associates @var{key} with @var{init}.
5218  @end deffn  @end deffn
5219    
5220  @deffn primitive hash-create-handle! table key init  @deffn {Scheme Procedure} hash-create-handle! table key init
5221    @deffnx {C Function} scm_hash_create_handle_x (table, key, init)
5222  This function looks up @var{key} in @var{table} and returns its handle.  This function looks up @var{key} in @var{table} and returns its handle.
5223  If @var{key} is not already present, a new handle is created which  If @var{key} is not already present, a new handle is created which
5224  associates @var{key} with @var{init}.  associates @var{key} with @var{init}.
5225  @end deffn  @end deffn
5226    
5227  @deffn primitive hashx-create-handle! hash assoc table key init  @deffn {Scheme Procedure} hashx-create-handle! hash assoc table key init
5228    @deffnx {C Function} scm_hashx_create_handle_x (hash, assoc, table, key, init)
5229  This behaves the same way as the corresponding  This behaves the same way as the corresponding
5230  @code{-create-handle} function, but uses @var{hash} as a hash  @code{-create-handle} function, but uses @var{hash} as a hash
5231  function and @var{assoc} to compare keys.  @code{hash} must be  function and @var{assoc} to compare keys.  @code{hash} must be
# Line 5012  table size.  @code{assoc} must be an ass Line 5234  table size.  @code{assoc} must be an ass
5234  @code{assoc}, @code{assq} or @code{assv}.  @code{assoc}, @code{assq} or @code{assv}.
5235  @end deffn  @end deffn
5236    
5237  @deffn primitive hash-fold proc init table  @deffn {Scheme Procedure} hash-fold proc init table
5238    @deffnx {C Function} scm_hash_fold (proc, init, table)
5239  An iterator over hash-table elements.  An iterator over hash-table elements.
5240  Accumulates and returns a result by applying PROC successively.  Accumulates and returns a result by applying PROC successively.
5241  The arguments to PROC are "(key value prior-result)" where key  The arguments to PROC are "(key value prior-result)" where key
# Line 5115  are always called from first to last whe Line 5338  are always called from first to last whe
5338  When calling @code{hook->list}, the procedures in the resulting list are  When calling @code{hook->list}, the procedures in the resulting list are
5339  in the same order as they would have been called by @code{run-hook}.  in the same order as they would have been called by @code{run-hook}.
5340    
5341  @deffn primitive make-hook [n_args]  @deffn {Scheme Procedure} make-hook [n_args]
5342    @deffnx {C Function} scm_make_hook (n_args)
5343  Create a hook for storing procedure of arity @var{n_args}.  Create a hook for storing procedure of arity @var{n_args}.
5344  @var{n_args} defaults to zero.  The returned value is a hook  @var{n_args} defaults to zero.  The returned value is a hook
5345  object to be used with the other hook procedures.  object to be used with the other hook procedures.
5346  @end deffn  @end deffn
5347    
5348  @deffn primitive hook? x  @deffn {Scheme Procedure} hook? x
5349    @deffnx {C Function} scm_hook_p (x)
5350  Return @code{#t} if @var{x} is a hook, @code{#f} otherwise.  Return @code{#t} if @var{x} is a hook, @code{#f} otherwise.
5351  @end deffn  @end deffn
5352    
5353  @deffn primitive hook-empty? hook  @deffn {Scheme Procedure} hook-empty? hook
5354    @deffnx {C Function} scm_hook_empty_p (hook)
5355  Return @code{#t} if @var{hook} is an empty hook, @code{#f}  Return @code{#t} if @var{hook} is an empty hook, @code{#f}
5356  otherwise.  otherwise.
5357  @end deffn  @end deffn
5358    
5359  @deffn primitive add-hook! hook proc [append_p]  @deffn {Scheme Procedure} add-hook! hook proc [append_p]
5360    @deffnx {C Function} scm_add_hook_x (hook, proc, append_p)
5361  Add the procedure @var{proc} to the hook @var{hook}. The  Add the procedure @var{proc} to the hook @var{hook}. The
5362  procedure is added to the end if @var{append_p} is true,  procedure is added to the end if @var{append_p} is true,
5363  otherwise it is added to the front.  The return value of this  otherwise it is added to the front.  The return value of this
5364  procedure is not specified.  procedure is not specified.
5365  @end deffn  @end deffn
5366    
5367  @deffn primitive remove-hook! hook proc  @deffn {Scheme Procedure} remove-hook! hook proc
5368    @deffnx {C Function} scm_remove_hook_x (hook, proc)
5369  Remove the procedure @var{proc} from the hook @var{hook}.  The  Remove the procedure @var{proc} from the hook @var{hook}.  The
5370  return value of this procedure is not specified.  return value of this procedure is not specified.
5371  @end deffn  @end deffn
5372    
5373  @deffn primitive reset-hook! hook  @deffn {Scheme Procedure} reset-hook! hook
5374    @deffnx {C Function} scm_reset_hook_x (hook)
5375  Remove all procedures from the hook @var{hook}.  The return  Remove all procedures from the hook @var{hook}.  The return
5376  value of this procedure is not specified.  value of this procedure is not specified.
5377  @end deffn  @end deffn
5378    
5379  @deffn primitive run-hook hook . args  @deffn {Scheme Procedure} run-hook hook . args
5380    @deffnx {C Function} scm_run_hook (hook, args)
5381  Apply all procedures from the hook @var{hook} to the arguments  Apply all procedures from the hook @var{hook} to the arguments
5382  @var{args}.  The order of the procedure application is first to  @var{args}.  The order of the procedure application is first to
5383  last.  The return value of this procedure is not specified.  last.  The return value of this procedure is not specified.
5384  @end deffn  @end deffn
5385    
5386  @deffn primitive hook->list hook  @deffn {Scheme Procedure} hook->list hook
5387    @deffnx {C Function} scm_hook_to_list (hook)
5388  Convert the procedure list of @var{hook} to a list.  Convert the procedure list of @var{hook} to a list.
5389  @end deffn  @end deffn
5390    

Legend:
Removed from v.1.1.2.5  
changed lines
  Added in v.1.1.2.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26