Go to the first, previous, next, last section, table of contents.


mapc

Function: mapc { [] fn -> }
file: 10-C-lists.muf
package: muf
status: alpha

The MUF mapc function is named and patterned after that of CommonLisp, although it is not quite the same. It provides a simple way of applying a function to many sets of arguments, when the function has no return values.

The mapc function accepts a block of lists and a function, which must accept as many arguments as there are lists in the block. On the first call to the given function, it is passed the first element in each of the given lists. On the second call, it recieves the second element from each list. This continues until one or more of the lists run out of elements:

Stack: 
[ [ "a" "b" "c" ]l [ 0 1 2 ]l |   :: , , "\n" , ;   mapc
0a
1b
2c
Stack: 


Go to the first, previous, next, last section, table of contents.