Skip to content

Commit

Permalink
update docs about using @spread to do rearrange
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed Sep 13, 2023
1 parent adaa71a commit 3cae3ae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 22 deletions.
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 1 addition & 17 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 3cae3ae

Please sign in to comment.