diff options
| author | Shinya Sato <shinnya.sato@gmail.com> | 2021-10-29 01:35:54 +0900 |
|---|---|---|
| committer | Shinya Sato <shinnya.sato@gmail.com> | 2021-10-29 01:35:54 +0900 |
| commit | d28e80274828540a3278ef20c3250afb576773d4 (patch) | |
| tree | 329944a21b8dc12653e2b3105fb8264df1fb3fad /sample/fib_9_abbr.in | |
| parent | 8b6cf5aa982859035c015c95f31e989add9af238 (diff) | |
| download | inpla-d28e80274828540a3278ef20c3250afb576773d4.tar.gz inpla-d28e80274828540a3278ef20c3250afb576773d4.zip | |
v0.5.0
Diffstat (limited to 'sample/fib_9_abbr.in')
| -rw-r--r-- | sample/fib_9_abbr.in | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sample/fib_9_abbr.in b/sample/fib_9_abbr.in new file mode 100644 index 0000000..57a8c62 --- /dev/null +++ b/sample/fib_9_abbr.in @@ -0,0 +1,16 @@ +// Fibonacci number + +// Rules +fib(ret) >< (int n) +| n == 0 => ret~0 +| n == 1 => ret~1 +| _ => cnt1 << fib(n-1), cnt2 << fib(n-2), ret << Add(cnt1,cnt2); + + +// Note: Add is implemented as a built-in agent such that: +// Add(ret, int m) ~ (int n) --> ret~(m+n); + +// Nets +ret << fib(9); +ret; + |
