Skip to main content
deleted 78 characters in body
Source Link
acl
  • 19.9k
  • 3
  • 66
  • 94
MapIndexed[{f1, f2, f3}[[Mod[First@#2, 3, 1]]][#1] &, data]

does what you want (except that it goes over all 20 elements, which I assume is what you wanted). (thanks to Sjoerd for pointing out a silly inefficiency).

MapIndexed[{f1, f2, f3}[[Mod[First@#2, 3, 1]]][#1] &, data]

does what you want (except that it goes over all 20 elements, which I assume is what you wanted). (thanks to Sjoerd for pointing out a silly inefficiency)

MapIndexed[{f1, f2, f3}[[Mod[First@#2, 3, 1]]][#1] &, data]

does what you want (thanks to Sjoerd for pointing out a silly inefficiency).

added 29 characters in body
Source Link
acl
  • 19.9k
  • 3
  • 66
  • 94

Not so elegant, but:

MapIndexed[{f1@#1f1, f2@#1f2, f3@#1f3}[[Mod[First@#2, 3, 1]]]1]]][#1] &, data]

does what you want (except that it goes over all 20 elements, which I assume is what you wanted). (thanks to Sjoerd for pointing out a silly inefficiency)

Not so elegant, but:

MapIndexed[{f1@#1, f2@#1, f3@#1}[[Mod[First@#2, 3, 1]]] &, data]

does what you want (except that it goes over all 20 elements, which I assume is what you wanted)

MapIndexed[{f1, f2, f3}[[Mod[First@#2, 3, 1]]][#1] &, data]

does what you want (except that it goes over all 20 elements, which I assume is what you wanted). (thanks to Sjoerd for pointing out a silly inefficiency)

Source Link
acl
  • 19.9k
  • 3
  • 66
  • 94

Not so elegant, but:

MapIndexed[{f1@#1, f2@#1, f3@#1}[[Mod[First@#2, 3, 1]]] &, data]

does what you want (except that it goes over all 20 elements, which I assume is what you wanted)