3 ms·
Wow, I just learned that Forth programmers do something similar to the "point free" style in Haskell (which is discouraged in excess). For example, if you have
by trealira 2y ago
Wow, I just learned that Forth programmers do something similar to the "point free" style in Haskell (which is discouraged in excess). For example, if you have a function like this:
-- f: returns the second argument minus the first
f :: Int -> Int -> Int
f x y = y - x
You could technically rewrite it like this:
f = flip (-)
In practice, I think the flip function is rarely used, except by bots online that rewrite your functions from ones that use variable names into ones that don't, e.g. the website "pointfree.io".
- astrobe_ 2y agoYes, Forth is point-free at its core, the only named variables that exist are global variables. The standard defines local variables as an optional extension.