Stream: Elpi users & devs

Topic: ✔ When does coq.elpi.accumulate take effect?


view this post on Zulip Enrico Tassi (Nov 10 2022 at 15:07):

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.

view this post on Zulip Enrico Tassi (Nov 10 2022 at 15:08):

In some sense coq.elpi.accumulate is "at compile time" what => is at runtime.

view this post on Zulip Notification Bot (Nov 10 2022 at 15:48):

Michael Soegtrop has marked this topic as resolved.


Last updated: Feb 04 2023 at 02:03 UTC