source: project/chicken/branches/release/manual/Unit extras @ 7276

Last change on this file since 7276 was 7276, checked in by felix winkelmann, 12 years ago

merged trunk

File size: 21.0 KB
Line 
1[[tags: manual]]
2[[toc:]]
3
4== Unit extras
5
6This unit contains a collection of useful utility definitions.
7This unit is used by default, unless the program
8is compiled with the {{-explicit-use}} option.
9
10
11=== Lists
12
13
14==== alist-ref
15
16 [procedure] (alist-ref KEY ALIST [TEST [DEFAULT]])
17
18Looks up {{KEY}} in {{ALIST}} using {{TEST}} as the comparison function (or {{eqv?}} if
19no test was given) and returns the cdr of the found pair, or {{DEFAULT}} (which defaults to {{#f}}).
20
21
22==== alist-update!
23
24 [procedure] (alist-update! KEY VALUE ALIST [TEST])
25
26If the list {{ALIST}} contains a pair of the form {{(KEY . X)}}, then this procedure
27replaces {{X}} with {{VALUE}} and returns {{ALIST}}. If {{ALIST}} contains no such item, then
28{{alist-update!}} returns {{((KEY . VALUE) . ALIST)}}. The optional argument
29{{TEST}} specifies the comparison procedure to search a matching pair in {{ALIST}}
30and defaults to {{eqv?}}.
31
32
33==== atom?
34
35 [procedure] (atom? X)
36
37Returns {{#t}} if {{X}} is not a pair. This is identical to {{not-pair?}} from [[Unit srfi-1]] but
38kept for historical reasons.
39
40
41==== rassoc
42
43 [procedure] (rassoc KEY LIST [TEST])
44
45Similar to {{assoc}}, but compares {{KEY}} with the {{cdr}} of each pair in {{LIST}} using
46{{TEST}} as the comparison procedures (which defaults to {{eqv?}}.
47
48
49==== butlast
50
51 [procedure] (butlast LIST)
52
53Returns a fresh list with all elements but the last of {{LIST}}.
54
55
56==== chop
57
58 [procedure] (chop LIST N)
59
60Returns a new list of sublists, where each sublist contains {{N}}
61elements of {{LIST}}. If {{LIST}} has a length that is not
62a multiple of {{N}}, then the last sublist contains the remaining
63elements.
64
65<enscript highlight=scheme>
66(chop '(1 2 3 4 5 6) 2) ==> ((1 2) (3 4) (5 6))
67(chop '(a b c d) 3)     ==> ((a b c) (d))
68</enscript>
69
70
71
72==== compress
73
74 [procedure] (compress BLIST LIST)
75
76Returns a new list with elements taken from {{LIST}} with
77corresponding true values in the list {{BLIST}}.
78
79<enscript highlight=scheme>
80(define nums '(99 100 110 401 1234))
81(compress (map odd? nums) nums)      ==> (99 401)
82</enscript>
83
84
85==== flatten
86
87 [procedure] (flatten LIST1 ...)
88
89Returns {{LIST1 ...}} concatenated together, with nested lists
90removed (flattened).
91
92
93==== intersperse
94
95 [procedure] (intersperse LIST X)
96
97Returns a new list with {{X}} placed between each element.
98
99
100==== join
101
102 [procedure] (join LISTOFLISTS [LIST])
103
104Concatenates the lists in {{LISTOFLISTS}} with {{LIST}} placed
105between each sublist. {{LIST}} defaults to the empty list.
106
107<enscript highlight=scheme>
108(join '((a b) (c d) (e)) '(x y)) ==> (a b x y c d x y e)
109(join '((p q) () (r (s) t)) '(-))  ==> (p q - - r (s) t)
110</enscript>
111
112{{join}} could be implemented as follows:
113
114<enscript highlight=scheme>
115(define (join lstoflsts #!optional (lst '()))
116  (apply append (intersperse lstoflists lst)) )
117</enscript>
118
119
120==== shuffle
121
122 [procedure] (shuffle LIST)
123
124Returns {{LIST}} with its elements sorted in a random order.
125
126
127==== tail?
128
129 [procedure] (tail? X LIST)
130
131Returns true if {{X}} is one of the tails (cdr's) of {{LIST}}.
132
133
134
135=== String-port extensions
136
137
138==== call-with-input-string
139
140 [procedure] (call-with-input-string STRING PROC)
141
142Calls the procedure {{PROC}} with a single argument that is a
143string-input-port with the contents of {{STRING}}.
144
145
146==== call-with-output-string
147
148 [procedure] (call-with-output-string PROC)
149
150Calls the procedure {{PROC}} with a single argument that is a
151string-output-port.  Returns the accumulated output-string.
152
153
154==== with-input-from-string
155
156 [procedure] (with-input-from-string STRING THUNK)
157
158Call procedure {{THUNK}} with the current input-port temporarily
159bound to an input-string-port with the contents of {{STRING}}.
160
161
162==== with-output-to-string
163
164 [procedure] (with-output-to-string THUNK)
165
166Call procedure {{THUNK}} with the current output-port temporarily
167bound to a string-output-port and return the accumulated output string.
168
169
170
171=== Formatted output
172
173
174==== printf
175==== fprintf
176==== sprintf
177
178 [procedure] (fprintf PORT FORMATSTRING ARG ...)
179 [procedure] (printf FORMATSTRING ARG ...)
180 [procedure] (sprintf FORMATSTRING ARG ...)
181
182Simple formatted output to a given port ({{fprintf}}), the
183value of {{(current-output-port)}} ({{printf}}), or a string
184({{sprintf}}).  The {{FORMATSTRING}} can contain any sequence
185of characters.  There must be at least as many {{ARG}} arguments given as there are format directives that require an argument in {{FORMATSTRING}}.  Extra {{ARG}} arguments are ignored.  The character `~' prefixes special formatting directives:
186
187<table>
188<tr><td> ~%
189write newline character
190</td></tr><tr><td> ~N
191the same as {{~%}}
192</td></tr><tr><td> ~S
193write the next argument
194</td></tr><tr><td> ~A
195display the next argument
196</td></tr><tr><td> ~\n
197skip all whitespace in the format-string until the next non-whitespace character
198</td></tr><tr><td> ~B
199write the next argument as a binary number
200</td></tr><tr><td> ~O
201write the next argument as an octal number
202</td></tr><tr><td> ~X
203write the next argument as a hexadecimal number
204</td></tr><tr><td> ~C
205write the next argument as a character
206</td></tr><tr><td> ~~
207display `~'
208</td></tr><tr><td> ~!
209flush all pending output
210</td></tr><tr><td> ~?
211invoke formatted output routine recursively with the next two arguments as format-string and list of parameters
212</td></tr></table>
213
214
215==== format
216
217 [procedure] (format [DESTINATION] FORMATSTRING ARG ...)
218
219The parameters  {{FORMATSTRING}} and {{ARG ...}} are as for
220({{printf}}/{{sprintf}}/{{fprintf}}).
221
222The optional {{DESTINATION}}, when supplied, performs
223a ({{sprintf}}) for a  {{#f}},
224a ({{printf}}) for a {{#t}},
225and a ({{fprintf}}) for an output-port.
226When missing a ({{sprintf}}) is performed.
227
228
229
230=== Hash tables
231
232CHICKEN implements SRFI-69. For more information,
233see [[http://srfi.schemers.org/srfi-69/srfi-69.html|SRFI-69]].
234
235A setter for {{hash-table-ref}} is defined, so
236
237<enscript highlight=scheme>
238(set! (hash-table-ref HT KEY) VAL)
239</enscript>
240
241is equivalent to
242
243<enscript highlight=scheme>
244(hash-table-set! HT KEY VAL)
245</enscript>
246
247As an extension to SRFI-69, {{hash-table-update!}} and {{hash-table-update!/default}} return
248the new value (after applying the update procedure).
249
250==== hash-table-remove!
251
252 [procedure] (hash-table-remove! HASHTABLE PROC)
253
254Calls {{PROC}} for all entries in {{HASHTABLE}} with the key and value of each
255entry. If {{PROC}} returns true, then that entry is removed.
256
257
258
259=== Queues
260
261
262==== list->queue
263
264 [procedure] (list->queue LIST)
265
266Returns {{LIST}} converted into a queue, where the first element
267of the list is the same as the first element of the queue. The resulting
268queue may share memory with the list and the list should not be modified
269after this operation.
270
271
272==== make-queue
273
274 [procedure] (make-queue)
275
276Returns a newly created queue.
277
278
279==== queue?
280
281 [procedure] (queue? X)
282
283Returns {{#t}} if {{X}} is a queue, or {{#f}} otherwise.
284
285
286==== queue->list
287
288 [procedure] (queue->list QUEUE)
289
290Returns {{QUEUE}} converted into a list, where the first element
291of the list is the same as the first element of the queue. The resulting
292list may share memory with the queue object and should not be modified.
293
294
295==== queue-add!
296
297 [procedure] (queue-add! QUEUE X)
298
299Adds {{X}} to the rear of {{QUEUE}}.
300
301
302==== queue-empty?
303
304 [procedure] (queue-empty? QUEUE)
305
306Returns {{#t}} if {{QUEUE}} is empty, or {{#f}} otherwise.
307
308
309==== queue-first
310
311 [procedure] (queue-first QUEUE)
312
313Returns the first element of {{QUEUE}}. If {{QUEUE}} is empty
314an error is signaled
315
316
317==== queue-last
318
319 [procedure] (queue-last QUEUE)
320
321Returns the last element of {{QUEUE}}. If {{QUEUE}} is empty
322an error is signaled
323
324
325==== queue-remove!
326
327 [procedure] (queue-remove! QUEUE)
328
329Removes and returns the first element of {{QUEUE}}. If {{QUEUE}}
330is empty an error is signaled
331
332
333==== queue-push-back!
334
335 [procedure] (queue-push-back! QUEUE ITEM)
336
337Pushes an item into the first position of a queue, i.e. the next
338{{queue-remove!}} will return {{ITEM}}.
339
340
341==== queue-push-back-list!
342
343 [procedure] (queue-push-back-list! QUEUE LIST)
344
345Pushes the items in item-list back onto the queue,
346so that {{(car LIST)}} becomes the next removable item.
347
348
349
350=== Sorting
351
352
353==== merge
354
355 [procedure] (merge LIST1 LIST2 LESS?)
356 [procedure] (merge! LIST1 LIST2 LESS?)
357
358Joins two lists in sorted order. {{merge!}} is the destructive
359version of merge. {{LESS?  }} should be a procedure of two arguments,
360that returns true if the first argument is to be ordered before the
361second argument.
362
363
364==== sort
365
366 [procedure] (sort SEQUENCE LESS?)
367 [procedure] (sort! SEQUENCE LESS?)
368
369Sort {{SEQUENCE}}, which should be a list or a vector. {{sort!}}
370is the destructive version of sort.
371
372
373==== sorted?
374
375 [procedure] (sorted? SEQUENCE LESS?)
376
377Returns true if the list or vector {{SEQUENCE}} is already sorted.
378
379
380
381=== Random numbers
382
383
384==== random
385
386 [procedure] (random N)
387
388Returns an exact random integer from 0 to {{N}}-1.
389
390
391==== randomize
392
393 [procedure] (randomize [X])
394
395Set random-number seed. If {{X}} is not supplied, the current time is used.
396On startup (when the {{extras}} unit is initialized), the random number generator
397is initialized with the current time.
398
399
400
401=== Input/Output extensions
402
403
404==== make-input-port
405
406 [procedure] (make-input-port READ READY? CLOSE [PEEK])
407
408Returns a custom input port. Common operations on this
409port are handled by the given parameters, which should be
410procedures of no arguments. {{READ}} is called when the
411next character is to be read and should return a character or
412{{#!eof}}. {{READY?}} is called
413when {{char-ready?}} is called on this port and should return
414{{#t}} or {{#f}}.  {{CLOSE}} is called when the port is
415closed. {{PEEK}} is called when {{peek-char}} is called on this
416port and should return a character or {{#!eof}}.
417if the argument {{PEEK}} is not given, then {{READ}} is used
418instead and the created port object handles peeking automatically (by
419calling {{READ}} and buffering the character).
420
421
422==== make-output-port
423
424 [procedure] (make-output-port WRITE CLOSE [FLUSH])
425
426Returns a custom output port. Common operations on this port are handled
427by the given parameters, which should be procedures.  {{WRITE}} is
428called when output is sent to the port and receives a single argument,
429a string.  {{CLOSE}} is called when the port is closed and should
430be a procedure of no arguments. {{FLUSH}} (if provided) is called
431for flushing the output port.
432
433
434==== pretty-print
435
436 [procedure] (pretty-print EXP [PORT])
437 [procedure] (pp EXP [PORT])
438
439Print expression nicely formatted. {{PORT}} defaults to the value
440of {{(current-output-port)}}.
441
442
443==== pretty-print-width
444(Parameter) Specifies the maximal line-width for pretty printing, after which line
445wrap will occur.
446
447==== read-byte
448==== write-byte
449
450 [procedure] (read-byte [PORT])
451 [procedure] (write-byte BYTE [PORT])
452
453Read/write a byte to the port given in {{PORT}}, which default to the values
454of {{(current-input-port)}} and {{(current-output-port)}}, respectively.
455
456==== read-file
457
458 [procedure] (read-file [FILE-OR-PORT [READER [MAXCOUNT]]])
459
460Returns a list containing all toplevel expressions
461read from the file or port {{FILE-OR-PORT}}. If no argument is given,
462input is read from the port that is the current value of {{(current-input-port)}}.
463After all expressions are read, and if the argument is a port, then the port will
464not be closed. The {{READER}} argument specifies the procedure used to read
465expressions from the given file or port and defaults to {{read}}. The reader
466procedure will be called with a single argument (an input port).
467If {{MAXCOUNT}} is given then only up to {{MAXCOUNT}} expressions will be read in.
468
469
470==== read-line
471==== write-line
472
473 [procedure] (read-line [PORT [LIMIT]])
474 [procedure] (write-line STRING [PORT])
475
476Line-input and -output. {{PORT}} defaults to the value of
477{{(current-input-port)}} and {{(current-output-port)}},
478respectively. If the optional argument {{LIMIT}} is given and
479not {{#f}}, then {{read-line}} reads at most {{LIMIT}}
480characters per line. {{read-line}} returns a string without the terminating newline and {{write-line}} adds a terminating newline  before outputting.
481
482
483==== read-lines
484
485 [procedure] (read-lines [PORT [MAX]])
486
487Read {{MAX}} or fewer lines from {{PORT}}. {{PORT}}
488defaults to the value of {{(current-input-port)}}. {{PORT}} may optionally be
489a string naming a file. Returns a list of strings, each string representing a line read, not including any line separation character(s).
490
491
492==== read-string
493==== read-string!
494==== write-string
495
496 [procedure] (read-string [NUM [PORT]])
497 [procedure] (read-string! NUM STRING [PORT [START]])
498 [procedure] (write-string STRING [NUM [PORT]]
499
500Read or write {{NUM}} characters from/to {{PORT}}, which defaults to the
501value of {{(current-input-port)}} or {{(current-output-port)}}, respectively.
502If {{NUM}} is {{#f}} or not given, then all data
503up to the end-of-file is read, or, in the case of {{write-string}} the whole
504string is written. If no more input is available, {{read-string}} returns the
505empty string. {{read-string!}} reads destructively into the given {{STRING}} argument,
506but never more characters that would fit into {{STRING}}. If {{START}} is given, then
507the read characters are stored starting at that position.
508{{read-string!}} returns the actual number of characters read.
509
510
511==== read-token
512
513 [procedure] (read-token PREDICATE [PORT])
514
515Reads characters from {{PORT}} (which defaults to the value of {{(current-input-port)}})
516and calls the procedure {{PREDICATE}} with each character until {{PREDICATE}} returns
517false. Returns a string with the accumulated characters.
518
519
520==== with-error-output-to-port
521
522 [procedure] (with-error-output-to-port PORT THUNK)
523
524Call procedure {{THUNK}} with the current error output-port
525temporarily bound to {{PORT}}.
526
527
528==== with-input-from-port
529
530 [procedure] (with-input-from-port PORT THUNK)
531
532Call procedure {{THUNK}} with the current input-port temporarily
533bound to {{PORT}}.
534
535
536==== with-output-to-port
537
538 [procedure] (with-output-to-port PORT THUNK)
539
540Call procedure {{THUNK}} with the current output-port temporarily
541bound to {{PORT}}.
542
543
544
545=== Strings
546
547
548==== conc
549
550 [procedure] (conc X ...)
551
552Returns a string with the string-represenation of all arguments concatenated
553together. {{conc}} could be implemented as
554
555<enscript highlight=scheme>
556(define (conc . args)
557  (apply string-append (map ->string args)) )
558</enscript>
559
560
561
562==== ->string
563
564 [procedure] (->string X)
565
566Returns a string-representation of {{X}}.
567
568
569==== string-chop
570
571 [procedure] (string-chop STRING LENGTH)
572
573Returns a list of substrings taken by ''chopping'' {{STRING}} every {{LENGTH}}
574characters:
575
576<enscript highlight=scheme>
577(string-chop "one two three" 4)  ==>  ("one " "two " "thre" "e")
578</enscript>
579
580
581
582==== string-chomp
583
584 [procedure] (string-chomp STRING [SUFFIX])
585
586If {{STRING}} ends with {{SUFFIX}}, then this procedure returns a copy of its first argument with the suffix
587removed, otherwise returns {{STRING}} unchanged. {{SUFFIX}} defaults to {{"\n"}}.
588
589
590==== string-compare3
591
592 [procedure] (string-compare3 STRING1 STRING2)
593 [procedure] (string-compare3-ci STRING1 STRING2)
594
595Perform a three-way comparison between the {{STRING1}} and {{STRING2}},
596returning either {{-1}} if {{STRING1}} is lexicographically less
597than {{STRING2}}, {{0}} if it is equal, or {{1}} if it s greater.
598{{string-compare3-ci}} performs a case-insensitive comparison.
599
600
601==== string-intersperse
602
603 [procedure] (string-intersperse LIST [STRING])
604
605Returns a string that contains all strings in {{LIST}} concatenated
606together.  {{STRING}} is placed between each concatenated string and
607defaults to {{" "}}.
608
609<enscript highlight=scheme>
610(string-intersperse '("one" "two") "three")
611</enscript>
612
613is equivalent to
614
615<enscript highlight=scheme>
616(apply string-append (intersperse '("one" "two") "three"))
617</enscript>
618
619
620==== string-split
621
622 [procedure] (string-split STRING [DELIMITER-STRING [KEEPEMPTY]])
623
624Split string into substrings separated by the given delimiters. If
625no delimiters are specified, a string comprising the tab, newline and space characters
626is assumed. If the
627parameter {{KEEPEMPTY}} is given and not {{#f}}, then empty
628substrings are retained:
629
630<enscript highlight=scheme>
631(string-split "one  two  three") ==> ("one" "two" "three")
632(string-split "foo:bar::baz:" ":" #t) ==> ("foo" "bar" "" "baz" "")
633</enscript>
634
635
636==== string-translate
637
638 [procedure] (string-translate STRING FROM [TO])
639
640Returns a fresh copy of {{STRING}} with characters matching
641{{FROM}} translated to {{TO}}.  If {{TO}} is omitted, then
642matching characters are removed. {{FROM}} and {{TO}} may be
643a character, a string or a list. If both {{FROM}} and {{TO}}
644are strings, then the character at the same position in {{TO}}
645as the matching character in {{FROM}} is substituted.
646
647
648==== string-translate*
649
650 [procedure] (string-translate* STRING SMAP)
651
652Substitutes elements of {{STRING}} according to {{SMAP}}.
653{{SMAP}} should be an association-list where each element of the list
654is a pair of the form {{(MATCH \. REPLACEMENT)}}. Every occurrence of
655the string {{MATCH}} in {{STRING}} will be replaced by the string
656{{REPLACEMENT}}:
657
658<enscript highlight=scheme>
659(string-translate*
660  "<h1>this is a \"string\"</h1>"
661  '(("<" . "&lt;") (">" . "&gt;") ("\"" . "&quot;")) )
662=>  "&lt;h1&gt;this is a &quot;string&quot;&lt;/ht&gt;"
663</enscript>
664
665
666==== substring=?
667
668 [procedure] (substring=? STRING1 STRING2 [START1 [START2 [LENGTH]]])
669 [procedure] (substring-ci=? STRING1 STRING2 [START1 [START2 [LENGTH]]])
670
671Returns {{#t}} if the strings {{STRING1}} and {{STRING2}} are equal, or
672{{#f}} otherwise.
673The comparison starts at the positions {{START1}} and {{START2}} (which default
674to 0), comparing {{LENGTH}} characters (which defaults to the minimum of the remaining
675length of both strings).
676
677
678==== substring-index
679
680 [procedure] (substring-index WHICH WHERE [START])
681 [procedure] (substring-index-ci WHICH WHERE [START])
682
683Searches for first index in string {{WHERE}} where string
684{{WHICH}} occurs.  If the optional argument {{START}} is given,
685then the search starts at that index.  {{substring-index-ci}}
686is a case-insensitive version of {{substring-index}}.
687
688
689
690=== Combinators
691
692
693==== any?
694
695 [procedure] (any? X)
696
697Ignores its argument and always returns {{#t}}. This is actually useful sometimes.
698
699
700==== constantly
701
702 [procedure] (constantly X ...)
703
704Returns a procedure that always returns the values {{X ...}} regardless of the number and value of its arguments.
705
706<enscript highlight=scheme>
707(constantly X) <=> (lambda args X)
708</enscript>
709
710
711==== complement
712
713 [procedure] (complement PROC)
714
715Returns a procedure that returns the boolean inverse of {{PROC}}.
716
717<enscript highlight=scheme>
718(complement PROC) <=> (lambda (x) (not (PROC x)))
719</enscript>
720
721
722==== compose
723
724 [procedure] (compose PROC1 PROC2 ...)
725
726Returns a procedure that represents the composition of the
727argument-procedures {{PROC1 PROC2 ...}}.
728
729<enscript highlight=scheme>
730(compose F G) <=> (lambda args
731                      (call-with-values
732                         (lambda () (apply G args))
733                         F))
734</enscript>
735
736{{(compose)}} is equivalent to {{values}}.
737
738
739==== conjoin
740
741 [procedure] (conjoin PRED ...)
742
743Returns a procedure that returns {{#t}} if its argument satisfies the
744predicates {{PRED ...}}.
745<enscript highlight=scheme>
746((conjoin odd? positive?) 33)   ==>  #t
747((conjoin odd? positive?) -33)  ==>  #f
748</enscript>
749
750
751==== disjoin
752
753 [procedure] (disjoin PRED ...)
754
755Returns a procedure that returns {{#t}} if its argument satisfies any
756predicate {{PRED ...}}.
757<enscript highlight=scheme>
758((disjoin odd? positive?) 32)    ==>  #t
759((disjoin odd? positive?) -32)   ==>  #f
760</enscript>
761
762
763
764==== each
765
766 [procedure] (each PROC ...)
767
768Returns a procedure that applies {{PROC ...}} to its arguments, and returns the result(s)
769of the last procedure application. For example
770
771<enscript highlight=scheme>
772(each pp eval)
773</enscript>
774
775is equivalent to
776
777<enscript highlight=scheme>
778(lambda args
779  (apply pp args)
780  (apply eval args) )
781</enscript>
782
783{{(each PROC)}} is equivalent to {{PROC}} and {{(each)}} is equivalent to
784{{noop}}.
785
786
787==== flip
788
789 [procedure] (flip PROC)
790
791Returns a two-argument procedure that calls {{PROC}} with its
792arguments swapped:
793<enscript highlight=scheme>
794(flip PROC) <=> (lambda (x y) (PROC y x))
795</enscript>
796
797
798==== identity
799
800 [procedure] (identity X)
801
802Returns its sole argument {{X}}.
803
804
805==== project
806
807 [procedure] (project N)
808
809Returns a procedure that returns its {{N}}th argument (starting from 0).
810
811
812==== list-of
813
814 [procedure] (list-of PRED)
815
816Returns a procedure of one argument that returns {{#t}} when
817applied to a list of elements that all satisfy the predicate procedure
818{{PRED}}, or {{#f}} otherwise.
819
820<enscript highlight=scheme>
821((list-of even?) '(1 2 3))   ==> #f
822((list-of number?) '(1 2 3)) ==> #t
823</enscript>
824
825
826==== noop
827
828 [procedure] (noop X ...)
829
830Ignores it's arguments, does nothing and returns an unspecified value.
831
832
833==== o
834
835 [procedure] (o PROC ...)
836
837A single value version of {{compose}} (slightly faster). {{(o)}} is equivalent
838to {{identity}}.
839
840=== Binary searching
841
842
843==== binary-search
844
845 [procedure] (binary-search SEQUENCE PROC)
846
847Performs a binary search in {{SEQUENCE}}, which should be a sorted
848list or vector.  {{PROC}} is called to compare items in the sequence,
849should accept a single argument and return an exact integer: zero if the
850searched value is equal to the current item, negative if the searched
851value is ''less'' than the current item, and positive otherwise.
852Returns the index of the found value or {{#f}} otherwise.
853
854Previous: [[Unit eval]]
855
856Next: [[Unit srfi-1]]
Note: See TracBrowser for help on using the repository browser.