Re:Why Isn't Functional Programming the Norm? [video]
by p33p on Thursday October 17, 2019 @08:00AM
(#21281073)
I think partial application and pipe operators make this so very intuitive though:
[butter, sugar, walnuts] |> mix() |> splitIntoPans(pans = 3) |> bake(time = 30, temp = 175) |> cool(time = 5)
Re:Why Isn't Functional Programming the Norm? [video]
by strangenessak on Thursday October 17, 2019 @08:41AM
(#21281397)
We can improve the syntax further
[butter, sugar, walnuts]
mix()
splitIntoPans(pans = 3)
bake(time = 30, temp = 175)
cool(time = 5)
Hmm, wait a second.....
Re:Why Isn't Functional Programming the Norm? [video]
by pkilgore on Thursday October 17, 2019 @09:22AM
(#21281736)
[butter, sugar, walnuts]
^^^
Somewhere wanted type CakeIngredients but missing record field "Flour"
If imperative style programming came with type inference on the level of the Ocaml compiler sign me up. For now, though, I can spare a few cycles in exchange for correct programs.
Re:Why Isn't Functional Programming the Norm? [video]
by antisemiotic on Thursday October 17, 2019 @09:31AM
(#21281828)
Careful, somewhere along that line you might even come to a conclusion that Haskell is world's most advanced imperative language, with the reprogrammable semicolons and whatnot.
Re:Why Isn't Functional Programming the Norm? [video]
by twic on Thursday October 17, 2019 @10:12AM
(#21282242)
Or, to coin a phrase: https://apps.dtic.mil/dtic/tr/fulltext/u2/a030751.pdf
cake = map (cool . bake 30 175) . splitIntoPans $ mix [ butter, sugar, walnuts ]