Get suffixes
Use scanr(:)[]
to get the suffixes of a list:
λ scanr(:)[] "abc"
["abc","bc","c",""]
This is much shorter than tails
after import Data.List
. You can do prefixes with scanl(\s cscanr(\_->s++[c]>init)[]=<<id
(found by Ørjan Johansen).
λ scanl(\s cscanr(\_->s++[c]>init)[]=<<id $ "abc"
["","a","ab","abc"]
This is longer but still beats the import. Pointfree is the same length:saves a byte over
scanl((.pure).(++)\s c->s++[c])[]