> IMHO, that would be the _insane_ definitions :-)  Firstly, nothing
> suggests to me that rationale of such behaviour.  

The rationale is:
1. these are useful functions
2. if this is insane, so is python. The corresponding python is:

        def take list n: return list[:n]
        def drop list n: return list[n:]
        
        Python interpreter example:
        >>> list="abcdef"
        >>> list[:-2]
        'abcd'
        >>> list[-2:]
        'ef'
        >>>
        
3. think of n as being calculated 'mod' length of the list
        take n list | n<0 = take (n `mod` (length list)) list
        drop n list | n<0 = drop (n `mod` (length list)) list
        --(equivalent definitions)

> Secondly, it would mean loosing an important set of laws:

>   drop n . drop m === drop (n + m)
>   take n . take m === take (n + m)
> (which, I note in passing, is broken also by suggestion A)

All the proposals break this law as well, so I this argument is weak (if
not insane :-))

-Alex-
___________________________________________________________________
S. Alexander Jacobson                   Shop.Com
1-212-697-0184 voice                    The Easiest Way To Shop


On Mon, 24 Jan 2000, Tommy Thorn wrote:

> S. Alexander Jacobson writes:
>  > The correct definitions would be:
>  > 
>  > take -2 -- drops the last 2 elements from the list
>  >            (takes everything except the last 2 elements)
>  > drop -2 -- grabs the last 2 elements from the list
>  >            (drops everything except the last 2 elements)
> ....
>  > These are also sane definitions..  
> 
> 
> 
> Regards,
> 
>    Tommy
> 




Reply via email to