Anonymous user
Apply a callback to an array: Difference between revisions
no edit summary
(Move zsh to UNIX Shell; add more shells.) |
No edit summary |
||
Line 62:
Map(Sample, Display'access);
end Call_Back_Example;</lang>
=={{header|Aime}}==
<lang aime>void
map(list l, void (*fp) (object))
{
integer i;
i = 0;
while (i < l_length(l)) {
fp(l_query(l, i));
i += 1;
}
}
void
out(object o)
{
o_integer(o);
o_byte(10);
}
integer
main(void)
{
list l;
l_append(l, 0);
l_append(l, 1);
l_append(l, 2);
l_append(l, 3);
map(l, out);
return 0;
}</lang>
=={{header|ALGOL 68}}==
|