Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
language:controlflow [2019/04/18 14:25] rajit [Selections] |
language:controlflow [2020/12/02 01:00] 127.0.0.1 external edit |
||
---|---|---|---|
Line 97: | Line 97: | ||
< | < | ||
(i : 32 : | (i : 32 : | ||
- | [ i = 0 -> r0(in[i], | + | [ i = 0 -> r0(in[i], |
- | [] else -> r[i](in[i], | + | [] else -> r[i](in[i], |
] | ] | ||
) | ) | ||
Line 110: | Line 110: | ||
the operators less than, less than or equal to, greater than, greater | the operators less than, less than or equal to, greater than, greater | ||
than or equal to, equal to, and not equal to respectively. | than or equal to, equal to, and not equal to respectively. | ||
+ | |||
+ | ===== Recursion ===== | ||
+ | |||
+ | Type definitions can be recursive. For instance, the following | ||
+ | definition can be used to create a tree structure. | ||
+ | |||
+ | < | ||
+ | template< | ||
+ | defproc tree (bool a[N]) | ||
+ | { | ||
+ | [ N = 1 -> leaf l(a[0]); | ||
+ | [] N > 1 -> tree< | ||
+ | | ||
+ | ] | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||