[Prev][Next][Index][Thread]

# Re: a programming prob.

- Date: Tue, 13 Feb 1996 21:48:48 PST
- From:
- Reply-To:
- Cc: moo-cows@parc.xerox.com

    --- You wrote:
    OBJECT.PROP = {"foo", {"bar", {"hello", "there"},
                   "qwerty", {"quaz", {"poi", {"moo", "cows"}}}}};

    and I had a verb that would return the numbers...
          {2, 4, 2, 2, 1}

    so OBJECT.PROP[2][4][2][2][1] would be "moo".
    How would I get another verb to find "moo" using those numbers without
    always having to have the same amount of numbers?
    --- end of quoted material ---

    cheap and offensive method:

    temp = tostr(args[1],".",args[3]);
    for x in (args[3])
       temp = tostr(temp,"[",x,"]");
    endfor
    return eval(temp);

    better method:

    :scanlist this none this
    "args: {OBJECT.PROP, {2, 4, 2, 2, 1, . . .}}";

    if (!args[2])
       return args[1];
    endif
    return this:scanlist(args[1][args[2]], listdelete(args[2]));

    -manta (recursion-boy)

- Prev: Re: a programming prob.
- Next: RE: a programming prob.
- Index: MOO-cows
- Thread: MOO-cows

Home | Subject Index | Thread Index