[DGD] Mappings

Erwin Harte harte at xs4all.nl
Fri Dec 14 00:20:18 CET 2001


On Thu, Dec 13, 2001 at 03:12:56PM -0800, Chooser Fireman wrote:
> I was wondering if there is a function similar to sscanf that I can
> find a match for partial input in a mapping?
> 
> ie. match attack with the user input of atta with a mapping?

Not in the general case but for that particular one you could use
mapping-subranges:

    string  verb, verb0, *matches;
    mapping verbs;

    verb0 = verb;
    verb0[strlen(verb0) - 1]++;

    matches = map_indices(verbs[verb..verb0]) - ({ verb0 });

This is untested code, so the usual disclaimers apply. ;-)

Erwin.
-- 
Erwin Harte <harte at xs4all.nl>
_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list