Open DavePearce opened 4 days ago
The initial syntax is not enough for these computations. Perhaps a slightly more ambitious syntax, which allows loops with state variables? I suppose we could restrict to forward loops / backward loops. For example:
(defcolumns (P :binary@prove) (VAL :i128))
(defcompute (FIRST :binary@prove) (:forward (TMP :i128 0) (MATCHED :binary@prove 0))
(if-not-zero P
(if-zero MATCHED (begin (set TMP VAL) (set MATCHED 1) 1)
(if-eq TMP VAL 0 1))))
Another possibility would be a functional style which use recursion instead of imperative loops, and passes state variables as parameters.
Overview
There is a need for a new set of computed columns. Its not clear at this stage the full set of requirements, but an initial idea was to introduce a generic
defcompute
syntax. This would be anAssignment
taking on a form roughly as follows:This then creates a computed column
A
whose contents are calculated by evaluating the expression+ X Y
. Already, in essence, this construct exists withingo-corset
(e.g. for handling inverse columns), but it is not accessible at the source level.Requirements
In addition, we want similar computations for
again
andlast
. The latter is roughly the same asfirst
, but done backwards. Likewise,again
can be computed asperspective && !first
.Traces