[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Goo Nitpicks
James Knight <jknight@fuhm.net> writes:
> On Friday, August 2, 2002, at 12:41 PM, Jonathan Bachrach wrote:
> > i would propose
> >
> > (take x n) == (sub x 0 n) == x[0:n]
> >
> > and
> >
> > (drop x n) == (sub x n (len x)) == x[n:]
> >
> > as is done in NESL (by guy e. blelloch). what this doesn't cover are
> > the cases where negative numbers are used as the second index. i
> > could have another sub, say sub* handles this case and keeps sub pure.
>
> I'd have to say this is getting close to the point of overloading my
> brain's namespace. What python accomplishes with one simple
> easy-to-remember construct (x[a:b]), we are now proposing to use
> *four* names for? That seems rather overboard. 'take' and 'drop'
> really don't jump out at me as having the meaning you're trying to
> push them into either.
thanks, i agree. keep it simple.
> I'd have to say I see no reason for 'take' at all. It is not hard to
> type (sub x 0 n). The form which 'drop' replaces - (sub x n (len x)) -
> is somewhat cumbersome, but could perhaps be more easily accomplished
> by allowing (sub x n 'end).
> "(dm sub (x|<seq> from|<int> below|(t= 'end)) (sub x from (len x)))".
that's pretty good, but it seems a bit impure. what about negative
integers for below? how often are these neg int limits used in python?
jonathan