4 ms·
Some functional patterns would be nice as well. Like summation and product are also folds and there are only imperative examples. This would be helpful as well
by maweki 5y ago
Some functional patterns would be nice as well. Like summation and product are also folds and there are only imperative examples.
This would be helpful as well:
foldr (*) 1 [1..6]
while this is the shown pattern:
var value = 1
for (var i = 1; i <= 6; i++) {
value *= i
}
- Koshkin 5y agoThis a very good point; I would also stress that mathematics itself is highly “functional” (in its modern form anyway), and that it is stateless (unlike its representation in an imperative language).
- bawolff 5y agoI feel like if you are used to programming in haskell, you'll have no problem with math syntax
- wyager 5y agoMath generally suffers from a great deal less precision than Haskell. It’s always a treat for me as a Haskell user to find a math or physics text that’s truly notationally precise. Only authors who really understand what they’re doing at a deep level can pull it off.
- jhgb 5y agoHave you read Structure and Interpretation of Classical Mechanics by any chance? Sounds right up your alley.