Skip to content

Commit

Permalink
test for spread
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed Sep 13, 2023
1 parent 2a8b291 commit 2f64d4a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 0 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ remove syntax of rearrange

update docs about using `@spread` to do rearrange



`(cons)` -- unconnected node as value -- redesign syntax of rearrange

```
Expand Down
15 changes: 15 additions & 0 deletions tests/builtin/spread.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
type Nat -- @Type end
node zero -- Nat :value! end
node add1 Nat :prev -- Nat :value! end

node add
Nat :target!
Nat :addend
--------
Nat :return
end

(add) @spread $target $addend $return
target @inspect
addend @inspect
return @inspect
3 changes: 3 additions & 0 deletions tests/builtin/spread.i.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
net_from_port (add₀)-target! end
net_from_port (add₀)-addend end
net_from_port (add₀)-return end
4 changes: 2 additions & 2 deletions tests/datatype/DiffList.test.i
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ require "Trivial.i"
claim one_two_soles -- Trivial DiffList end

define one_two_soles
sole (cons :tail) diff @rot @rot @connect
sole (cons :tail) sole cons diff @rot @rot @connect
(diff) @spread $front sole cons front @connect
(diff) @spread $front sole cons sole cons front @connect
diff_append
end

Expand Down

0 comments on commit 2f64d4a

Please sign in to comment.