Hava Language Tutorial
Pascal's Triangle illustrates an important feature of Hava:
indexed values are stored when calculated, and
retrieved upon subsequent requests.
In other words, an indexed variable may look like a
function, but it acts more like a repository of numbers.
In this respect, indexed variables resemble the cells
of a spreadsheet.
Because of this feature, calculating the first 10 rows
of Pascal's triangle requires 45 additions.
If C(n,k) had been implemented as a function, it would
have required 1013 additions.
(We used Hava to get this number. Can you?)
Back
-
Home
-
Next
|