let rec list_sum l =
match l with
[] -> 0
| (x :: rl) -> x + list_sum rl
let rec partial_vector_sum von n =
if n = 0 then 0
else von.(n - 1) + partial_vector_sum von (n - 1)
let vector_sum von =
partial_vector_sum von von.Length
Tuesday, January 2, 2007
EOPL - 1.2.3 - Other Patterns of Recursion
Forgot to post the code for this section. Simple stuff, and only three functions.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment