Hacker News new | past | comments | ask | show | jobs | submit login

In TCL, zip functionality is built into the foreach loop.

     foreach x $list1 y $list2 {
         lappend result [Myfunc $x $y]
     }

To directly return a list of outputs without having to append to a list, TCL also provides lmap which works the same way:

     lmap x $list1 y $list2 {Myfunc $x $y}

But wait there's more! Foreach and lmap also support taking more than one element from the list each time:

     lmap {x y} $list1 {Myfunc $x $y}



It's gauche to flaunt the power of the gods among mortals.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: