Lecture 2026-01-29
Accumulators
int f (int c, int acc){
if(cont(c)){
body(c);
return f(update1(c), update2(acc,c));
}
return g(acc)
}
f(c,acc,0)int acc = acc0;
while (cont(c)){
body(c);
acc= update2(acc,c);
c=update1(c);
}
acc= g(acc);Alternate Format
Peekchar version:
Updating Counters
Specialized Syntax
Incrementing decreasing by 1.
More on Global Data:
Intermediate Mutation ( Racket )
Substitution Model
Last updated