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 | 9998 reads
|
Browse archives
Active forum topics |
Recent comments
20 weeks 1 day ago
20 weeks 1 day ago
20 weeks 1 day ago
42 weeks 2 days ago
46 weeks 4 days ago
48 weeks 1 day ago
48 weeks 1 day ago
50 weeks 6 days ago
1 year 3 weeks ago
1 year 3 weeks ago