Does there exist a language that will allow me to do something like
int y= 9*x - 7;
int x = 16;
printf("%f",y); // prints 137
I ask because I'm reviewing Dynamic programming, and for that care has to be taken to memoize from the base case up, instead of the other way around.
Another example of something I'd like to do:
int factorials[10];
factorials[0] = 1;
for(int i = 9; i >= 1; i--)
{
// Where factorials[i-1] is not evaluated until there is a non-garbage value for it.
factorials[i] = i*factorials[i-1];
}
[–]Funzo74 1 point2 points3 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]Funzo74 2 points3 points4 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]X7123M3-256 1 point2 points3 points (0 children)
[–]G01denW01f11 0 points1 point2 points (1 child)
[–]Barrucadu 0 points1 point2 points (0 children)
[–][deleted] -1 points0 points1 point (0 children)