Does Haskell have similar syntactic sugar to Python List Slices?
For instance in Python:
x = [\'a\',\'b\',\'c\',\'d\']
x[1:3]
give
Obviously my foldl version loses against the take-drop approach, but maybe someone sees a way to improve it?
slice from to = reverse.snd.foldl build ((from, to + 1), []) where
build res@((_, 0), _) _ = res
build ((0, to), xs) x = ((0, to - 1), x:xs)
build ((from, to), xs) _ = ((from - 1, to - 1), xs)