Zulip Chat Archive
Stream: general
Topic: left shift on lists
Chris Hughes (Jun 01 2018 at 16:31):
Is there a function on lists that rotates the elements of the list i.e [1, 2, 3, 4] -> [2, 3, 4, 1]?
Simon Hudon (Jun 01 2018 at 16:32):
For list xs
, you can do it with drop 1 xs ++ take 1 xs
Kevin Buzzard (Jun 01 2018 at 18:11):
you'd better remember what you dropped :-)
Simon Hudon (Jun 01 2018 at 18:32):
yep! That's whattake 1 xs
does
Last updated: Dec 20 2023 at 11:08 UTC