-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Match macro with examples of templates. Use #(lf,test_pets.trac)' to see
- Loading branch information
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
( Example of templates | ||
) | ||
#(lf,match.trac) | ||
#(ds,dog,Dog[x]) | ||
#(ss,dog,x) | ||
#(ds,cat,Cat[x]) | ||
#(ss,cat,x) | ||
#(ds,cat_says,x says "meow") | ||
#(ss,cat_says,x) | ||
#(ds,dog_says,x says "woof") | ||
#(ss,dog_says,x,else) | ||
#(ds,pets,(Pets[x,y])) | ||
#(ss,pets,x,y) | ||
#(ds,pets_say,X and Y say "wow") | ||
#(ss,pets_say,X,Y) | ||
#(ds,says,(#(match,cat,(x),cat_says,#(match,dog,(x),dog_says,#(match,pets,(x),pets_say,what?))))) | ||
#(ss,says,x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
( match macro: #(match,template,string,result,else) | ||
template and result are functions defined via ds/ss | ||
) | ||
#(ds,chk_arg,(#(eq,(arg),(),else,#(fun,arg)))) | ||
#(ss,chk_arg,fun,arg,else) | ||
#(ds,match,(#(chk_arg,func,##(te,name,(expr)),else))) | ||
#(ss,match,name,expr,func,else) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
( Testing of templates | ||
) | ||
#(lf,def_pets.trac) | ||
( | ||
Test cat | ||
) | ||
#(says,Cat[Alice]) | ||
( | ||
Test dog | ||
) | ||
#(says,Dog[Bob]) | ||
( | ||
Test both | ||
) | ||
#(says,(Pets[Alice,Bob])) | ||
( | ||
Test unknown | ||
) | ||
#(says,Cow) |