Next Previous Up Top Contents Index

9.4 DUIM-Frames Module

complete-from-generator

Generic function

Summary

Completes a string based on a generated list of completions.

Signature

complete-from-generator string generator delimiters 
#key action predicate
=> string success object nmatches completions

Arguments

string
An instance of type <string>.

generator
An instance of type <function>.

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.

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 a list of possibilities derived from generator, using the specified delimiters to break both string and the generated possibilities into chunks. This function is identical to complete-from-sequence, except that the list of possibilities is derived from the generator function, rather than passed explicitly. The generator is a function of two arguments: the string to be completed and a continuation co-routine to call that performs the completion. It should call the continuation with two arguments: the completion string and an object.

The argument 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-generator
  ("th", method (string, completer)
           for (b in #["one", "two", "three", "four"])
             completer(b, b)
           end
         end method, #[' ', '-'])

See also

complete-from-sequence, page 729


Functional Developer Library Reference: DUIM - 3 Dec 1998

Next Previous Up Top Contents Index