3 ms·
Better yet, compare f = glork_to_floob (crumb_to_glork c) versus f = floob_of_glork (glork_of_crumb c) and picture the first style inside a more com
by abecedarius 3y ago
Better yet, compare
f = glork_to_floob (crumb_to_glork c)
versus
f = floob_of_glork (glork_of_crumb c)
and picture the first style inside a more complex function with more constructors/conversions.
- tome 3y agoYes, even better example, thanks! In Haskell you get f = floob_of_glork . glork_of_crumb . crumb_of_zing which is much better than f = glork_to_floob . crumb_to_glork . zing_to_crumb
- nequo 3y agoInteresting. The pipe operator is more idiomatic in OCaml where this would be crumb_of_zing x |> glork_of_crumb |> floob_of_glork versus zing_to_crumb x |> crumb_to_glork |> glork_to_floob
- abecedarius 3y agoYeah, fair. Forth especially really commits to that left-to-right order in its general style -- I like it when a language and its culture are conscious about readability in this way.
- tome 3y agoIt is interesting that the "of" style is common in Ocaml where the left-to-right style is common. They seem to clash! I would like to know what it's like to work in a fully left-to-right language, for example, to define `my_floob`: let my_crumb |> zing_to_crumb |> crumb_to_glork |> glork_to_floob = my_floob
- nequo 3y agoIn addition to Forth, R can do this too: x |> zing_to_crumb() |> crumb_to_glork() |> glork_to_floob() -> my_floob But it is not idiomatic.