3 ms·
Why are all the variables functions? They're just numbers. There's no need at all for them to be functions that just return numbers.
by NackerHughes 2y ago
Why are all the variables functions? They're just numbers. There's no need at all for them to be functions that just return numbers.
- dndn1 2y agoIn this example it might not be so practical, but in calculang everything is a function including constants. This is because of an emphasis on flexibility. They're a constant here but in another calculang model I can call calculations from this same code while asking for specific pieces of the calculation to be different. e.g. if I have a population growth assumption then in an exercise I can get all these numbers allowing for population growth - without myself touching these formulas. Population then depends on time and must be a function. On calculang.dev I say that formulas (functions) are the building blocks of calculations, and they're the mechanism for flexibility (also transparency).