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

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

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

revision 1.1.2.3 by ossau, Tue Mar 12 20:51:25 2002 UTC revision 1.1.2.4 by ossau, Fri Mar 15 09:23:18 2002 UTC
# Line 47  procedures for testing for equality are Line 47  procedures for testing for equality are
47  the three kinds of @dfn{sameness} defined above.  the three kinds of @dfn{sameness} defined above.
48    
49  @rnindex eq?  @rnindex eq?
50  @deffn primitive eq? x y  @deffn {Scheme Procedure} eq? x y
51  Return @code{#t} iff @var{x} references the same object as @var{y}.  Return @code{#t} iff @var{x} references the same object as @var{y}.
52  @code{eq?} is similar to @code{eqv?} except that in some cases it is  @code{eq?} is similar to @code{eqv?} except that in some cases it is
53  capable of discerning distinctions finer than those detectable by  capable of discerning distinctions finer than those detectable by
# Line 55  capable of discerning distinctions finer Line 55  capable of discerning distinctions finer
55  @end deffn  @end deffn
56    
57  @rnindex eqv?  @rnindex eqv?
58  @deffn primitive eqv? x y  @deffn {Scheme Procedure} eqv? x y
59  The @code{eqv?} procedure defines a useful equivalence relation on objects.  The @code{eqv?} procedure defines a useful equivalence relation on objects.
60  Briefly, it returns @code{#t} if @var{x} and @var{y} should normally be  Briefly, it returns @code{#t} if @var{x} and @var{y} should normally be
61  regarded as the same object.  This relation is left slightly open to  regarded as the same object.  This relation is left slightly open to
# Line 64  and inexact numbers. Line 64  and inexact numbers.
64  @end deffn  @end deffn
65    
66  @rnindex equal?  @rnindex equal?
67  @deffn primitive equal? x y  @deffn {Scheme Procedure} equal? x y
68  Return @code{#t} iff @var{x} and @var{y} are recursively @code{eqv?} equivalent.  Return @code{#t} iff @var{x} and @var{y} are recursively @code{eqv?} equivalent.
69  @code{equal?} recursively compares the contents of pairs,  @code{equal?} recursively compares the contents of pairs,
70  vectors, and strings, applying @code{eqv?} on other objects such as  vectors, and strings, applying @code{eqv?} on other objects such as
# Line 89  closures than for other kinds of objects Line 89  closures than for other kinds of objects
89  a property list associated with a procedure object, use the  a property list associated with a procedure object, use the
90  @code{procedure} functions; otherwise, use the @code{object} functions.  @code{procedure} functions; otherwise, use the @code{object} functions.
91    
92  @deffn primitive object-properties obj  @deffn {Scheme Procedure} object-properties obj
93  @deffnx primitive procedure-properties obj  @deffnx {Scheme Procedure} procedure-properties obj
94    @deffnx {C Function} scm_object_properties (obj)
95  Return @var{obj}'s property list.  Return @var{obj}'s property list.
96  @end deffn  @end deffn
97    
98  @deffn primitive set-object-properties! obj alist  @deffn {Scheme Procedure} set-object-properties! obj alist
99  @deffnx primitive set-procedure-properties! obj alist  @deffnx {Scheme Procedure} set-procedure-properties! obj alist
100    @deffnx {C Function} scm_set_object_properties_x (obj, alist)
101  Set @var{obj}'s property list to @var{alist}.  Set @var{obj}'s property list to @var{alist}.
102  @end deffn  @end deffn
103    
104  @deffn primitive object-property obj key  @deffn {Scheme Procedure} object-property obj key
105  @deffnx primitive procedure-property obj key  @deffnx {Scheme Procedure} procedure-property obj key
106    @deffnx {C Function} scm_object_property (obj, key)
107  Return the property of @var{obj} with name @var{key}.  Return the property of @var{obj} with name @var{key}.
108  @end deffn  @end deffn
109    
110  @deffn primitive set-object-property! obj key value  @deffn {Scheme Procedure} set-object-property! obj key value
111  @deffnx primitive set-procedure-property! obj key value  @deffnx {Scheme Procedure} set-procedure-property! obj key value
112    @deffnx {C Function} scm_set_object_property_x (obj, key, value)
113  In @var{obj}'s property list, set the property named @var{key}  In @var{obj}'s property list, set the property named @var{key}
114  to @var{value}.  to @var{value}.
115  @end deffn  @end deffn
# Line 117  the user provides a "property table" tha Line 121  the user provides a "property table" tha
121  @node Primitive Properties  @node Primitive Properties
122  @section Primitive Properties  @section Primitive Properties
123    
124  @deffn primitive primitive-make-property not_found_proc  @deffn {Scheme Procedure} primitive-make-property not_found_proc
125    @deffnx {C Function} scm_primitive_make_property (not_found_proc)
126  Create a @dfn{property token} that can be used with  Create a @dfn{property token} that can be used with
127  @code{primitive-property-ref} and @code{primitive-property-set!}.  @code{primitive-property-ref} and @code{primitive-property-set!}.
128  See @code{primitive-property-ref} for the significance of  See @code{primitive-property-ref} for the significance of
129  @var{not_found_proc}.  @var{not_found_proc}.
130  @end deffn  @end deffn
131    
132  @deffn primitive primitive-property-ref prop obj  @deffn {Scheme Procedure} primitive-property-ref prop obj
133    @deffnx {C Function} scm_primitive_property_ref (prop, obj)
134  Return the property @var{prop} of @var{obj}.  When no value  Return the property @var{prop} of @var{obj}.  When no value
135  has yet been associated with @var{prop} and @var{obj}, call  has yet been associated with @var{prop} and @var{obj}, call
136  @var{not-found-proc} instead (see @code{primitive-make-property})  @var{not-found-proc} instead (see @code{primitive-make-property})
# Line 134  and use its return value.  That value is Line 140  and use its return value.  That value is
140  default value of @var{prop}.  default value of @var{prop}.
141  @end deffn  @end deffn
142    
143  @deffn primitive primitive-property-set! prop obj val  @deffn {Scheme Procedure} primitive-property-set! prop obj val
144    @deffnx {C Function} scm_primitive_property_set_x (prop, obj, val)
145  Associate @var{code} with @var{prop} and @var{obj}.  Associate @var{code} with @var{prop} and @var{obj}.
146  @end deffn  @end deffn
147    
148  @deffn primitive primitive-property-del! prop obj  @deffn {Scheme Procedure} primitive-property-del! prop obj
149    @deffnx {C Function} scm_primitive_property_del_x (prop, obj)
150  Remove any value associated with @var{prop} and @var{obj}.  Remove any value associated with @var{prop} and @var{obj}.
151  @end deffn  @end deffn
152    
# Line 161  The first group of procedures can be use Line 169  The first group of procedures can be use
169  be already sorted on their own) and produce sorted lists containing  be already sorted on their own) and produce sorted lists containing
170  all elements of the input lists.  all elements of the input lists.
171    
172  @deffn primitive merge alist blist less  @deffn {Scheme Procedure} merge alist blist less
173    @deffnx {C Function} scm_merge (alist, blist, less)
174  Take two lists @var{alist} and @var{blist} such that  Take two lists @var{alist} and @var{blist} such that
175  @code{(sorted? alist less?)} and @code{(sorted? blist less?)} and  @code{(sorted? alist less?)} and @code{(sorted? blist less?)} and
176  returns a new list in which the elements of @var{alist} and  returns a new list in which the elements of @var{alist} and
# Line 169  returns a new list in which the elements Line 178  returns a new list in which the elements
178  @code{(sorted? (merge alist blist less?) less?)}.  @code{(sorted? (merge alist blist less?) less?)}.
179  @end deffn  @end deffn
180    
181  @deffn primitive merge! alist blist less  @deffn {Scheme Procedure} merge! alist blist less
182    @deffnx {C Function} scm_merge_x (alist, blist, less)
183  Takes two lists @var{alist} and @var{blist} such that  Takes two lists @var{alist} and @var{blist} such that
184  @code{(sorted? alist less?)} and @code{(sorted? blist less?)} and  @code{(sorted? alist less?)} and @code{(sorted? blist less?)} and
185  returns a new list in which the elements of @var{alist} and  returns a new list in which the elements of @var{alist} and
# Line 189  If two or more elements are the same acc Line 199  If two or more elements are the same acc
199  predicate, they are left in the same order as they appeared in the  predicate, they are left in the same order as they appeared in the
200  input.  input.
201    
202  @deffn primitive sorted? items less  @deffn {Scheme Procedure} sorted? items less
203    @deffnx {C Function} scm_sorted_p (items, less)
204  Return @code{#t} iff @var{items} is a list or a vector such that  Return @code{#t} iff @var{items} is a list or a vector such that
205  for all 1 <= i <= m, the predicate @var{less} returns true when  for all 1 <= i <= m, the predicate @var{less} returns true when
206  applied to all elements i - 1 and i  applied to all elements i - 1 and i
207  @end deffn  @end deffn
208    
209  @deffn primitive sort items less  @deffn {Scheme Procedure} sort items less
210    @deffnx {C Function} scm_sort (items, less)
211  Sort the sequence @var{items}, which may be a list or a  Sort the sequence @var{items}, which may be a list or a
212  vector.  @var{less} is used for comparing the sequence  vector.  @var{less} is used for comparing the sequence
213  elements.  This is not a stable sort.  elements.  This is not a stable sort.
214  @end deffn  @end deffn
215    
216  @deffn primitive sort! items less  @deffn {Scheme Procedure} sort! items less
217    @deffnx {C Function} scm_sort_x (items, less)
218  Sort the sequence @var{items}, which may be a list or a  Sort the sequence @var{items}, which may be a list or a
219  vector.  @var{less} is used for comparing the sequence  vector.  @var{less} is used for comparing the sequence
220  elements.  The sorting is destructive, that means that the  elements.  The sorting is destructive, that means that the
# Line 209  input sequence is modified to produce th Line 222  input sequence is modified to produce th
222  This is not a stable sort.  This is not a stable sort.
223  @end deffn  @end deffn
224    
225  @deffn primitive stable-sort items less  @deffn {Scheme Procedure} stable-sort items less
226    @deffnx {C Function} scm_stable_sort (items, less)
227  Sort the sequence @var{items}, which may be a list or a  Sort the sequence @var{items}, which may be a list or a
228  vector. @var{less} is used for comparing the sequence elements.  vector. @var{less} is used for comparing the sequence elements.
229  This is a stable sort.  This is a stable sort.
230  @end deffn  @end deffn
231    
232  @deffn primitive stable-sort! items less  @deffn {Scheme Procedure} stable-sort! items less
233    @deffnx {C Function} scm_stable_sort_x (items, less)
234  Sort the sequence @var{items}, which may be a list or a  Sort the sequence @var{items}, which may be a list or a
235  vector. @var{less} is used for comparing the sequence elements.  vector. @var{less} is used for comparing the sequence elements.
236  The sorting is destructive, that means that the input sequence  The sorting is destructive, that means that the input sequence
# Line 226  This is a stable sort. Line 241  This is a stable sort.
241  The procedures in the last group only accept lists or vectors as input,  The procedures in the last group only accept lists or vectors as input,
242  as their names indicate.  as their names indicate.
243    
244  @deffn primitive sort-list items less  @deffn {Scheme Procedure} sort-list items less
245    @deffnx {C Function} scm_sort_list (items, less)
246  Sort the list @var{items}, using @var{less} for comparing the  Sort the list @var{items}, using @var{less} for comparing the
247  list elements. This is a stable sort.  list elements. This is a stable sort.
248  @end deffn  @end deffn
249    
250  @deffn primitive sort-list! items less  @deffn {Scheme Procedure} sort-list! items less
251    @deffnx {C Function} scm_sort_list_x (items, less)
252  Sort the list @var{items}, using @var{less} for comparing the  Sort the list @var{items}, using @var{less} for comparing the
253  list elements. The sorting is destructive, that means that the  list elements. The sorting is destructive, that means that the
254  input list is modified to produce the sorted result.  input list is modified to produce the sorted result.
255  This is a stable sort.  This is a stable sort.
256  @end deffn  @end deffn
257    
258  @deffn primitive restricted-vector-sort! vec less startpos endpos  @deffn {Scheme Procedure} restricted-vector-sort! vec less startpos endpos
259    @deffnx {C Function} scm_restricted_vector_sort_x (vec, less, startpos, endpos)
260  Sort the vector @var{vec}, using @var{less} for comparing  Sort the vector @var{vec}, using @var{less} for comparing
261  the vector elements.  @var{startpos} and @var{endpos} delimit  the vector elements.  @var{startpos} and @var{endpos} delimit
262  the range of the vector which gets sorted.  The return value  the range of the vector which gets sorted.  The return value
# Line 257  procedures for copying vectors.  @code{c Line 275  procedures for copying vectors.  @code{c
275  application, as it does not only copy the spine of a list, but also  application, as it does not only copy the spine of a list, but also
276  copies any pairs in the cars of the input lists.  copies any pairs in the cars of the input lists.
277    
278  @deffn primitive copy-tree obj  @deffn {Scheme Procedure} copy-tree obj
279    @deffnx {C Function} scm_copy_tree (obj)
280  Recursively copy the data tree that is bound to @var{obj}, and return a  Recursively copy the data tree that is bound to @var{obj}, and return a
281  pointer to the new data structure.  @code{copy-tree} recurses down the  pointer to the new data structure.  @code{copy-tree} recurses down the
282  contents of both pairs and vectors (since both cons cells and vector  contents of both pairs and vectors (since both cons cells and vector
# Line 283  Converting an object back from the strin Line 302  Converting an object back from the strin
302  type has a read syntax and the read syntax is preserved by the printing  type has a read syntax and the read syntax is preserved by the printing
303  procedure.  procedure.
304    
305  @deffn primitive object->string obj [printer]  @deffn {Scheme Procedure} object->string obj [printer]
306    @deffnx {C Function} scm_object_to_string (obj, printer)
307  Return a Scheme string obtained by printing @var{obj}.  Return a Scheme string obtained by printing @var{obj}.
308  Printing function can be specified by the optional second  Printing function can be specified by the optional second
309  argument @var{printer} (default: @code{write}).  argument @var{printer} (default: @code{write}).

Legend:
Removed from v.1.1.2.3  
changed lines
  Added in v.1.1.2.4

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