Is there some direct and simple "cyclic Take", sometimes also known as "overtake" in Mathematica. That is, if the take specification runs out of elements, it just cycles back to the beginning (as many times as necessary).
For example, if the functions were named OverTake, then:
OverTake[{1, 2}, 5]
(* {1, 2, 1, 2, 1} *)
(This would be a direct analog of the take functions in the array-processing languages APL and J.)
I can clumsily code a function to do that, but I was hoping for a simple use of something built in.
PadRight[{}, 5, {1, 2}]? – Szabolcs Nov 11 '15 at 20:51Takeusage when requesting fewer elements than the length of the list. Please post it as an answer! – MarcoB Nov 11 '15 at 21:06"Periodic"argument toPadRight. It will be once this is closed, right? – murray Nov 11 '15 at 22:56PadRight[...,"Periodic"]. – kglr Nov 11 '15 at 23:03"Periodic"withPadRightin the other answer, I don't see why it shouldn't be preserved here as well. – MarcoB Nov 11 '15 at 23:04