divert(`-1')changequote([,])define([BEGIN],[dnl])define([END],[dnl])
define([fix],[define([$1],[format([[%d]],[$2])])])
BEGIN. the Ullman set
define([ullmanset],[dnl
ifelse(eval([$#]>2),1,dnl nargs>2?
ifdef([$1.n],dnl
ifelse($2,1,dnl
ifdef([sum],sum($1),dnl
define([sum],
[defn([$1.n])])sum($1)),dnl
ifelse($2,2,dnl
ifdef([ismember],ismember($1,value),dnl
define([ismember],[dnl
])ismember($1,value)),dnl
ifelse($2,3,dnl
ifdef([add],add(),dnl
define([add],[dnl
])add()),dnl
ifelse($2,4,dnl
ifdef([del],del(),dnl
define([del],[dnl
])del($1,value)),dnl
ifelse($2,5,dnl
ifdef([clear],clear(),dnl
define([clear],[dnl
])clear($1)),dnl
ifelse($2,6,dnl
ifdef([get],get($1,value),dnl
define([get],[dnl
])get($1,value)),dnl
)))))),dnl
ifelse($2,0,dnl
define([init],[dnl
define([s],[define(format([[$1.member[%s]]],[N]),get($1,N))])
]))dnl
),)
])
END.
divert[]dnl sc1cc1c1

Greetings, this is more of a template that works minimally with functionality to be added where functions could be.
Could you imagine a possible use such as this of m4 to impose run-time data structures accessible from the top
function. Or ways if, coding this way, how repetitive conditional ifelse, ifdef (mapping functions to expand when
top calling function's arguments provide for it) could be improved?
Interesting? Thanks



_______________________________________________
m4-discuss mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/m4-discuss

Reply via email to