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

# Re: Wrong

- Date: Sun, 17 Mar 1996 19:13:59 PST
- From:
- Cc: moo-cows-digest@parc.xerox.com
- Content-Type: text/plain; charset="us-ascii"

    At 06:58 PM 3/17/96 PST, Christopher Unkel wrote:
    >On Sun, 17 Mar 1996, Hans Friedrich-- wrote:
    >
    >> old=callers(@args);
    >> old=listdelete(old, length(old));
    >> new={};
    >> for x in (old)
    >>   if (x[3..5] != {"", #-1, #-1})
    >>     new={@new, x};
    >>   endif
    >> endfor
    >> return new;
    >
    >I goofed when I first wrote this code.  Replace the first two lines:
    >
    >> old=callers(@args);
    >> old=listdelete(old, length(old));
    >
    >with:
    >
    >old=callers()[2..$];
    >
    >(Which deletes the *first* element of the callers(), list, instead of the
    >first.)
    >
    >If you use it the way I wrote it originally, you'll eliminate all
    >built-ins, but the first element of the return value will be the call to
    >:old_callers, and what should be the last element of the return will be
    >missing.
    >
    >Thus are the dangers of writing even the simplest code late at night
    >without checking it very carefully illustrated.  Sorry.

    I see the problem here. The verb name is x[2], you're taking [3..5] which is
    wrong since #3 is the permissions, you're checking for it to be a string
    which it can't be.
    Here's my $callers() verb that works fine:

    callers = callers(@args)[2..$];
    for vb in (callers)
      vb[1] == #-1 && vb[4] == #-1 && vb[2] != "" && (callers = setremove(callers,
    vb));
    endfor
    return callers;

- Prev: Re: Wrong
- Next: Re: WWW on MOO
- Index: MOO-cows
- Thread: MOO-cows

Home | Subject Index | Thread Index