-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Ralf Wildenhues on 8/16/2008 3:02 AM: >>>> Also, should it be named slightly differently since it behaves more >>>> like m4_map than m4_foreach? >>> m4_map_pair maybe? >> I went with the name m4_transform_pair, since it turned out to be very >> easy to add m4_transform with similar semantics but visiting one argument >> at a time. > > Isn't there precedence in lisp for this kind of functionality, > where we can reuse names from?
In emacs and in perl, the name "map" is closest to what m4_transform is doing - taking a code snippet and a list, and applying each element (or pair of elements, for m4_transform_pair) of the list in turn as the argument to the code snippet. But m4_map is already taken, where it is passing an entire argument list to the code snippet, rather than a single argument, and with the list of lists provided as a single argument. For an example, these have the same behavior: m4_map([m4_echo], [[[one]], [[two]], [[three]]]) m4_transform([m4_echo], [one], [two], [three]) At any rate, I'm interested in documenting these macros, as well as adding a counterpart macro for m4_set iteration (the recent _AS_DETECT_BETTER_SHELL change can be sped up). It turns out that m4 is more efficient when you pass the list element as an argument to a macro invocation than it is with m4_foreach semantics of doing m4_define of the list element to a temporary name, then doing m4_defn of that temporary name to get back to the list element. I originally went with the name m4_transform because m4_map was taken, but maybe m4_map_each and m4_map_pair might make more sense? Any thoughts on whether I should rename m4_transform before documenting it, and if so, to what? - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkjwtZkACgkQ84KuGfSFAYDbzQCeLduYmz5csd/mNCqvGYF+56yi l1oAoJEKP+GiLWMesgnwxRq3BCpnyMJ1 =Ln4S -----END PGP SIGNATURE-----
