On Tuesday, January 25, 2000 8:38 AM, S. Alexander Jacobson [SMTP:[EMAIL PROTECTED]] wrote:
          Why not do what python does?

        drop -2 -- drops the last 2 elements from the list
        take -2 -- grabs the last 2 elements from the list

        take n list | n<0 = drop (length list + n) list
        drop n list | n<0 = take (length list + n) list

        [...]
        I think this solution also satisfies Chris Okasaki's:  

        take n xs ++ drop n xs == xs

        (except where the list is infinite)

try it:
take -2 [1,2,3,4] -> [3,4]
drop -2 [1,2,3,4] -> [1,2]
take -2 [1,2,3,4] ++ drop -2 [1,2,3,4] -> [3,4,1,2]

--brian

Reply via email to