| 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 | 10332 reads | Browse archives
 Active forum topics | 
Recent comments
3 days 1 hour ago
3 days 2 hours ago
3 days 2 hours ago
3 weeks 3 days ago
4 weeks 2 days ago
4 weeks 2 days ago
4 weeks 3 days ago
4 weeks 3 days ago
4 weeks 3 days ago
4 weeks 6 days ago