Commit e53dc269 authored by POTTIER Francois's avatar POTTIER Francois

Define [fa] using [iter] instead of [reduce].

parent c30ff5f2
......@@ -7,6 +7,8 @@
(* -------------------------------------------------------------------------- *)
(* [fa] could be defined in terms of [reduce], as follows. *)
#define FA_CLASS __fa
#define FA_FUN(term) CONCAT(fa_, term)
......@@ -20,6 +22,26 @@
let FA_FUN(term) t = \
new FA_CLASS # VISIT(term) () t \
#undef __FA
#undef FA
(* -------------------------------------------------------------------------- *)
(* We prefer to define [fa] in terms of [iter] because we wish to eliminate
our dependency on [reduce] visitors. *)
#define __FA \
class FA_CLASS = object \
inherit [_] iter \
inherit [_] KitFa.iter \
end \
#define FA(term) \
let FA_FUN(term) t = \
let o = new FA_CLASS in \
o # VISIT(term) KitFa.empty t; \
o # accu
(* -------------------------------------------------------------------------- *)
#define FILTER_CLASS __filter
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment