Fix values
This commit is contained in:
parent
ae7d6c5359
commit
5edad332cd
19 changed files with 611 additions and 331 deletions
|
|
@ -2,10 +2,10 @@ list := []
|
|||
|
||||
x := 1
|
||||
while x <= 1000 {
|
||||
list = list.append(x)
|
||||
assert(list.reduce(func(tot, a){
|
||||
list.append(x)
|
||||
assertEq(list.reduce(func(tot, a){
|
||||
return tot + a
|
||||
}, 0) == x*(x + 1)/2)
|
||||
}, 0), x*(x + 1)/2)
|
||||
|
||||
x = x + 1
|
||||
}
|
||||
|
|
@ -17,8 +17,8 @@ func sum(a, b) {
|
|||
list = []
|
||||
x = 1
|
||||
while x <= 100 {
|
||||
list = list.append(2*x - 1)
|
||||
assert(list.reduce(sum, 0) == x*x)
|
||||
list.append(2*x - 1)
|
||||
assertEq(list.reduce(sum, 0), x*x)
|
||||
|
||||
x = x + 1
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue