Accumulation happens when the program ends, the doc is a bit short:
https://github.com/LPCIC/coq-elpi/blob/master/coq-builtin.elpi#L1644
This is how I usually do:
Require Import elpi.elpi.
Elpi Db age.db lp:{{
pred age o:string, o:int.
:name "age.fail"
age Name _ :- coq.error "I don't know who" Name "is!".
}}.
Elpi Command set_age.
Elpi Accumulate Db age.db.
Elpi Accumulate lp:{{
main [str Name, int Age] :-
coq.say "Pre" Name Age,
Clause = (age Name Age),
coq.elpi.accumulate _ "age.db" (clause _ (before "age.fail") Clause),
Clause => (
age Name AgeDb,
coq.say "Post" Name AgeDb
).
}}.
Elpi Typecheck.
Elpi set_age "alice" 21.
In some sense coq.elpi.accumulate
is "at compile time" what =>
is at runtime.
Michael Soegtrop has marked this topic as resolved.
Last updated: Feb 04 2023 at 02:03 UTC