Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow rules to take arguments #326

Open
bvssvni opened this issue Jun 18, 2018 · 0 comments
Open

Allow rules to take arguments #326

bvssvni opened this issue Jun 18, 2018 · 0 comments

Comments

@bvssvni
Copy link
Member

bvssvni commented Jun 18, 2018

Sometimes you have several similar rules like this:

sum_in = [label {"sum" "∑"} in_body]
sum_short = [label {"sum" "∑"} short_body]
prod_in = [label {"prod" "∏"} in_body]
prod_short = [label {"prod" "∏"} short_body]

loops = {sum_in:"sum_in" sum_short:"sum_short" prod_in:"prod_in" prod_short:"prod_short"}

By allowing rules to take arguments:

l(op : a b) = {[label op in_body]:a [label op short_body]:b}

loops = {l({"sum" "∑"} : "sum_in" "sum_short") l({"prod" "∏"} : "prod_in" "prod_short")}

Notice the pattern <rules> : <strings> when passing arguments.

This might also allow external storage of rules in the future, such as a vocabulary.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant