Method code for $data_lib.data_map()

[Turn on line numbering]
arg val, method, options, @args;
var i, args, object, class;

object = (| options['object] |);
switch (type(val)) {
    case 'list:
        if ((| options['list] |))
            return object ? object.(method)(val, @args) : val.(method)(@args);
        return map i in (val) to (refresh() && .data_map(i, method, options, @args));
    case 'dictionary:
        if ((| options['dictionary] |))
            return object ? object.(method)(val, @args) : val.(method)(@args);
        if ((| options['keys] |))
            return hash i in (val) to ([.data_map(i[1], method, options, @args), refresh() && .data_map(i[2], method, options, @args)]);
        return hash i in (val) to ([i[1], refresh() && .data_map(i[2], method, options, @args)]);
    case 'frob:
        if ((| (class = options['class]) |)) {
            if ((| class(val) in class |))
                return object ? object.(method)(val, @args) : val.(method)(@args);
            else
                return val;
        }
        return (<class(val), (.data_map(val.value(), method, options, @args))>);
    default:
        if ((| options['all] |) || (| options[type(val)] |))
            return object ? object.(method)(val, @args) : val.(method)(@args);
        return val;
}

// $#Edited: 04 Aug 97 14:17 $miro

["// Created 07-Dec-1996 as a part of ColdCore, see: @help Credit"]

the Cold Dark