From ecb798fd7f9239cc21e89a777f5ffbaff48aabd7 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sun, 26 May 2024 21:24:41 +0100 Subject: Use range --- examples/fold.fco | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'examples') 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 -- cgit v1.2.3