diff --git a/README.md b/README.md index 893c91bd..3ebb7a98 100644 --- a/README.md +++ b/README.md @@ -181,13 +181,20 @@ end import zero from "https://cdn.inet.run/tests/datatype/Nat.i" import cons from "https://cdn.inet.run/tests/datatype/List.i" -zero (cons :tail) zero cons diff @rot @rot @connect -zero (cons :tail) zero cons diff @rot @rot @connect +(diff) @spread $front $back $value +back zero cons zero cons front @connect value +(diff) @spread $front $back $value +back zero cons zero cons front @connect value diff_append -zero (cons :tail) zero cons diff @rot @rot @connect -zero (cons :tail) zero cons diff @rot @rot @connect -diff_append @run $result +// The code above can be simplified +// by using less named local variables. + +(diff) @spread $front zero cons zero cons front @connect +(diff) @spread $front zero cons zero cons front @connect +diff_append + +@run $result ``` ## Development diff --git a/TODO.md b/TODO.md index c48fc0dd..90e5df4a 100644 --- a/TODO.md +++ b/TODO.md @@ -1,23 +1,7 @@ -update docs about using `@spread` to do rearrange +update links to playground -- for `@spread` `(cons)` -- unconnected node as value -- redesign syntax of rearrange -``` -(cons) @spread $value $tail $head -zero head @connect value zero cons diff $value tail @connect value -(cons) @spread $value $tail $head -zero head @connect value zero cons diff $value tail @connect value -diff_append -``` - -``` -(cons) @spread $value $tail zero @connect -value zero cons diff $value tail @connect value -(cons) @spread $value $tail zero @connect -value zero cons diff $value tail @connect value -diff_append -``` - ``` (diff) @spread $front $back $value back zero cons zero cons front @connect value