45 |
consisting of the two numbers 1 and 2, and a pair containing the symbols |
consisting of the two numbers 1 and 2, and a pair containing the symbols |
46 |
@code{foo} and @code{bar} can be entered. It is very important to write |
@code{foo} and @code{bar} can be entered. It is very important to write |
47 |
the whitespace before and after the dot, because otherwise the Scheme |
the whitespace before and after the dot, because otherwise the Scheme |
48 |
parser whould not be able to figure out where to split the tokens. |
parser would not be able to figure out where to split the tokens. |
49 |
|
|
50 |
@lisp |
@lisp |
51 |
(1 . 2) |
(1 . 2) |
270 |
|
|
271 |
Note that @code{list-copy} only makes a copy of the pairs which make up |
Note that @code{list-copy} only makes a copy of the pairs which make up |
272 |
the spine of the lists. The list elements are not copied, which means |
the spine of the lists. The list elements are not copied, which means |
273 |
that modifying the elements of the new list also modyfies the elements |
that modifying the elements of the new list also modifies the elements |
274 |
of the old list. On the other hand, applying procedures like |
of the old list. On the other hand, applying procedures like |
275 |
@code{set-cdr!} or @code{delv!} to the new list will not alter the old |
@code{set-cdr!} or @code{delv!} to the new list will not alter the old |
276 |
list. If you also need to copy the list elements (making a deep copy), |
list. If you also need to copy the list elements (making a deep copy), |
861 |
|
|
862 |
Vtables, themselves structures, are first class representations of |
Vtables, themselves structures, are first class representations of |
863 |
disjoint sub-types of structures in general. In most cases, when a |
disjoint sub-types of structures in general. In most cases, when a |
864 |
new structure is created, programmers must specifiy a vtable for the |
new structure is created, programmers must specify a vtable for the |
865 |
new structure. Each vtable has a field describing the layout of its |
new structure. Each vtable has a field describing the layout of its |
866 |
instances. Vtables can have additional, user-defined fields as well. |
instances. Vtables can have additional, user-defined fields as well. |
867 |
@end itemize |
@end itemize |
893 |
created with this type of field, the field is initialized to refer to |
created with this type of field, the field is initialized to refer to |
894 |
the structure's own handle. This kind of field is mainly useful when |
the structure's own handle. This kind of field is mainly useful when |
895 |
mixing Scheme and C code in which the C code may need to compute a |
mixing Scheme and C code in which the C code may need to compute a |
896 |
structure's handle given only the address of its malloced data. |
structure's handle given only the address of its malloc-ed data. |
897 |
@end itemize |
@end itemize |
898 |
|
|
899 |
|
|
954 |
In the above example, field 0 contains the size of the vector and |
In the above example, field 0 contains the size of the vector and |
955 |
fields beginning at 1 contain the vector elements. |
fields beginning at 1 contain the vector elements. |
956 |
|
|
957 |
A kind of tagged vector (a constant tag followed by conventioal |
A kind of tagged vector (a constant tag followed by conventional |
958 |
vector elements) might be: |
vector elements) might be: |
959 |
|
|
960 |
@example |
@example |
1725 |
@subsubsection Alist Key Equality |
@subsubsection Alist Key Equality |
1726 |
|
|
1727 |
All of Guile's dedicated association list procedures, apart from |
All of Guile's dedicated association list procedures, apart from |
1728 |
@code{acons}, come in three flavours, depending on the level of equality |
@code{acons}, come in three flavors, depending on the level of equality |
1729 |
that is required to decide whether an existing key in the association |
that is required to decide whether an existing key in the association |
1730 |
list is the same as the key that the procedure call uses to identify the |
list is the same as the key that the procedure call uses to identify the |
1731 |
required entry. |
required entry. |
1864 |
@deffnx {C Function} scm_assq_set_x (alist, key, val) |
@deffnx {C Function} scm_assq_set_x (alist, key, val) |
1865 |
@deffnx {C Function} scm_assv_set_x (alist, key, val) |
@deffnx {C Function} scm_assv_set_x (alist, key, val) |
1866 |
@deffnx {C Function} scm_assoc_set_x (alist, key, val) |
@deffnx {C Function} scm_assoc_set_x (alist, key, val) |
1867 |
Reassociate @var{key} in @var{alist} with @var{value}: find any existing |
Re-associate @var{key} in @var{alist} with @var{value}: find any existing |
1868 |
@var{alist} entry for @var{key} and associate it with the new |
@var{alist} entry for @var{key} and associate it with the new |
1869 |
@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}, |
1870 |
add a new one. Return the (possibly new) alist. |
add a new one. Return the (possibly new) alist. |
2297 |
@deffn {Scheme Procedure} hashq key size |
@deffn {Scheme Procedure} hashq key size |
2298 |
@deffnx {C Function} scm_hashq (key, size) |
@deffnx {C Function} scm_hashq (key, size) |
2299 |
Determine a hash value for @var{key} that is suitable for |
Determine a hash value for @var{key} that is suitable for |
2300 |
lookups in a hashtable of size @var{size}, where @code{eq?} is |
lookups in a hash table of size @var{size}, where @code{eq?} is |
2301 |
used as the equality predicate. The function returns an |
used as the equality predicate. The function returns an |
2302 |
integer in the range 0 to @var{size} - 1. Note that |
integer in the range 0 to @var{size} - 1. Note that |
2303 |
@code{hashq} may use internal addresses. Thus two calls to |
@code{hashq} may use internal addresses. Thus two calls to |
2311 |
@deffn {Scheme Procedure} hashv key size |
@deffn {Scheme Procedure} hashv key size |
2312 |
@deffnx {C Function} scm_hashv (key, size) |
@deffnx {C Function} scm_hashv (key, size) |
2313 |
Determine a hash value for @var{key} that is suitable for |
Determine a hash value for @var{key} that is suitable for |
2314 |
lookups in a hashtable of size @var{size}, where @code{eqv?} is |
lookups in a hash table of size @var{size}, where @code{eqv?} is |
2315 |
used as the equality predicate. The function returns an |
used as the equality predicate. The function returns an |
2316 |
integer in the range 0 to @var{size} - 1. Note that |
integer in the range 0 to @var{size} - 1. Note that |
2317 |
@code{(hashv key)} may use internal addresses. Thus two calls |
@code{(hashv key)} may use internal addresses. Thus two calls |
2325 |
@deffn {Scheme Procedure} hash key size |
@deffn {Scheme Procedure} hash key size |
2326 |
@deffnx {C Function} scm_hash (key, size) |
@deffnx {C Function} scm_hash (key, size) |
2327 |
Determine a hash value for @var{key} that is suitable for |
Determine a hash value for @var{key} that is suitable for |
2328 |
lookups in a hashtable of size @var{size}, where @code{equal?} |
lookups in a hash table of size @var{size}, where @code{equal?} |
2329 |
is used as the equality predicate. The function returns an |
is used as the equality predicate. The function returns an |
2330 |
integer in the range 0 to @var{size} - 1. |
integer in the range 0 to @var{size} - 1. |
2331 |
@end deffn |
@end deffn |