Next Previous Up Top Contents Index

9.4 DUIM-Frames Module

complete-from-sequence

Generic function

Summary

Completes a string based on a list of possible completions.

Signature

complete-from-sequence string possibilities delimiters 
#key action predicate label-key value-key
=> string success object nmatches completions

Arguments

string
An instance of type <string>.

possibilities
An instance of type limited(<sequence>, of: <string>).

delimiters
An instance of type limited(<sequence>, of: <character>).

action
An instance of type one-of(#"complete", #"complete-limited", #"complete-maximal", #"completions", #"apropos-completions"). Default value #"complete".

predicate
An instance of type false-or(<function>). Default value #f.

label-key
An instance of type <function>. Default value first.

value-key
An instance of type <function>. Default value second.

Values

string
An instance of type false-or(<string>).

success
An instance of type <boolean>.

object
An instance of type <object>.

nmatches
An instance of type <integer>.

completions
An instance of type <sequence>.

Library

duim-frames

Module

duim-frames

Description

Completes string chunk-wise against the list of possibilities, using the specified delimiters to break both string and the strings in possibilities into chunks.

The label-key and value-key arguments are used to extract the completion string and object from the entries in possibilities, and predicate (if supplied) is applied to filter out unwanted objects.

The function returns five values: the completed string (if there is one), whether or not the completion successfully matched, the object associated with the completion, the number of things that matched, and (if action is #"completions") a sequence of possible completions.

The action argument can take any of the following values:

#"complete"
Completes the input as much as possible, except that if the user's input exactly matches one of the possibilities, the shorter possibility is returned as the result, even if it is a left substring of another possibility.

#"complete-limited"
Completes the input up to the next partial delimiter.

#"complete-maximal"
Completes the input as much as possible.

#"completions" or #"apropos-completions"

Returns a sequence of the possible completions.

Example

complete-from-sequence("s w ma",
                       #["one fish two fish", 
                         "red fish blue fish",
                         "single white male", 
                         "on beyond zebra"], 
                       #[' ', '-'],
                       label-key: identity, 
                       value-key: identity)

See also

complete-from-generator, page 727


Functional Developer Library Reference: DUIM - 3 Dec 1998

Next Previous Up Top Contents Index