comparison tools/foreach.m4 @ 63:f4b792afa74e

m4 translator
author Thinker K.F. Li <thinker@branda.to>
date Tue, 12 Aug 2008 14:21:09 +0800
parents
children
comparison
equal deleted inserted replaced
62:7d976d925431 63:f4b792afa74e
1 divert([-1])
2
3 define([_arg1], [$1])
4
5 define([_foreach], [ifelse([$2], [()], [],
6 [define([$1], _arg1$2)$3[]_foreach([$1], (shift$2), [$3])])])
7
8 define([foreach], [pushdef([$1])_foreach($@)popdef([$1])])
9
10 divert[]dnl