diff options
author | Juan J. Martinez <jjm@usebox.net> | 2024-05-26 21:24:41 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2024-05-26 21:24:41 +0100 |
commit | ecb798fd7f9239cc21e89a777f5ffbaff48aabd7 (patch) | |
tree | 18c81020055ae581b18463f68755e3ed577213cc | |
parent | 00680c131470b7f14243cdc3271fb302d8cfc4f7 (diff) | |
download | funco-ecb798fd7f9239cc21e89a777f5ffbaff48aabd7.tar.gz funco-ecb798fd7f9239cc21e89a777f5ffbaff48aabd7.zip |
Use range
-rw-r--r-- | examples/fold.fco | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/examples/fold.fco b/examples/fold.fco index 97b6de8..44df435 100644 --- a/examples/fold.fco +++ b/examples/fold.fco @@ -6,19 +6,7 @@ def op(acc x) end end -# generate a list with integers from 1 to n-1 -def range(n) - def genrec(l limit n) - if <(n limit) - @genrec(+(l list(n)) limit +(n 1)) - else - l - end - end - genrec(list() n 0) -end - # add odd numbers from 0 to 1000 def main() - display(fold(0 op range(1001))) + display(fold(0 op ..(0 1000))) end |