kadena-io / pact

The Pact Smart Contract Language
https://docs.kadena.io/build/pact
BSD 3-Clause "New" or "Revised" License
581 stars 100 forks source link

[WIP] Memoization tables #1246

Open imalsogreg opened 1 year ago

imalsogreg commented 1 year ago

Add memotables to the pact state. We will temporarily ignore exactly what this will eventually be used for.

For now, we only want a memo table to exist in the pact state, and we provide a repl-only function to add entries to the memo table. This command should put (shift 10 1) => 20 into the memo table:

pact> (env-memoize shift 10 1)
"Ok"

In subsequent evaluations that include (shift 10 1) as a subterm, 20 should be substituted immediately instead of recomputing (shift 10 1).

The PR does not work right now:

pact> (env-memoize shift 10 1)
...
<interactive>:1:0:Error: Expected def: native `shift`  ...

I'm still trying to fix this.

PR checklist:

Additionally, please justify why you should or should not do the following:

imalsogreg commented 1 year ago

@jmcardon Think I should close this PR? Did we decide that all L2-related work will be against pact-core?

imalsogreg commented 1 year ago

@jmcardon Think I should close this PR? Did we decide that all L2-related work will be against pact-core?