Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,14 @@
pragma.enable("one-method-object") # "def _.get" is experimental shorthand
def sum(&i, lo, hi, &term) { # bind i and term to passed slots
var temp := 0
i := lo
while (i <= hi) { # E has numeric-range iteration but it creates a distinct
temp += term # variable which would not be shared with the passed i
i += 1
}
return temp
}
{
var i := null
sum(&i, 1, 100, def _.get() { return 1/i })
}

View file

@ -0,0 +1,6 @@
def sum(lo, hi, f) {
var temp := 0
for i in lo..hi { temp += f(i) }
return temp
}
sum(1, 100, fn i { 1/i })