Skip to main content
1 of 2
Leonid Shifrin
  • 114.9k
  • 16
  • 333
  • 424

Here is one way:

movingMapCircular[f_, l_List] := MapThread[f@* List, {l, RotateLeft[l]}];

For example:

movingMapCircular[f, {1, 2, 3, 4}]

(* {f[{1, 2}], f[{2, 3}], f[{3, 4}], f[{4, 1}]} *)
Leonid Shifrin
  • 114.9k
  • 16
  • 333
  • 424