Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there some functions like zip and fold in Perl?

Tags:

zip

map

perl

fold

I want to use some function such as "zip", "fold" and "map" in perl. (Just like in Haskell.) I found map and it works well. Then, is there zip and fold? Thank you very much.

like image 323
madper Avatar asked Nov 28 '22 03:11

madper


1 Answers

The List::Util library includes reduce(), which does essentially what fold does.

List::MoreUtils contains a zip() function.

Neither is built-in, mostly because Perl is not a functional programming language.

like image 72
Wooble Avatar answered Dec 05 '22 02:12

Wooble