Is “map” a loop?

后端 未结 15 2028
自闭症患者
自闭症患者 2020-12-14 14:29

While answering this question, I came to realize that I was not sure whether Perl\'s map can be considered a loop or not?

On one hand, it quacks/walks l

15条回答
  •  孤街浪徒
    2020-12-14 15:22

    A map in Perl is a higher order function that applies a given function to all elements of an array and returns the modified array.

    Whether this is implemented using an iterative loop or by recursion or any other way is not relevant and unspecified.

    So a map is not a loop, though it may be implemented using a loop.

提交回复
热议问题