User loginNavigation |
Don't use "Yield" for co-routines; instead use "Postpone"A pattern followed “↑” and a type can be used to match the pattern with something which has been extended from the type. For example, PostponedFringe.[aTree:Tree]:FutureList◅String▻ ≡ aTree � aLeaf↑Leaf ⦂ [aLeaf.getString[ ]] ⍌ aFork↑Fork ⦂ [⩛Fringe.[aFork.getLeft[ ]], ⩛Postpone Fringe.[aFork.getRight[ ]]]▮ For example, ["The", "boy"]▮ is equivalent to the following: The procedure Fringe can be used to define SameFringe? that determines if two trees have the same fringe [Hewitt 1972]: SameFringe?.[aTree:Tree, anotherTree:Tree]:Boolean ≡ // test if two trees have the same fringe PostponedFringe.[aTree] = PostponedFringe.[anotherTree]▮ For example, [False, True]▮ is equivalent to the following: Let aList ← PostponedFringe.[Fork.[Leaf.["The"], Leaf.["boy"]]]。 // aList = ["The", "boy"] [SameFringe?.[aList, ["The", "girl"], // False SameFringe?.[aList, ["The", "boy"]]]▮ // True Note that Leaf can be defined as an extension of Tree: Actor Leaf.[aString:String] extension Tree using getString[ ]:String → aString▮ and Fork can be defined as an extension of Tree: Actor Fork.[aLeft:Tree, aRight:Tree] extension Tree using getLeft[ ]:Tree → aLeft, getRight[ ]:Tree → aRight▮ Edited for clarity. By Hewitt at 2015-08-11 21:18 | LtU Forum | previous forum topic | next forum topic | other blogs | 9989 reads
|
Browse archives
Active forum topics |
Recent comments
16 weeks 4 days ago
16 weeks 4 days ago
16 weeks 4 days ago
38 weeks 5 days ago
43 weeks 12 hours ago
44 weeks 4 days ago
44 weeks 4 days ago
47 weeks 2 days ago
51 weeks 6 days ago
52 weeks 21 min ago