3 ms·
If that blew you away you really should try Ruby: def call(fn, val) = fn.(val) call(->(n){ n + 5 }, 10)
by cutler 3y ago
If that blew you away you really should try Ruby:
def call(fn, val) = fn.(val)
call(->(n){ n + 5 }, 10)
- takeda 3y agoIt is still hard to understand unless you are familiar with the language. Python got popular because it made it simple. Ruby on the other hand encouraged cleverness like what you wrote. I think ruby faded for the same reason perl did. It is cool to write code, but once it's time to maintain it, especially after the rock star who wrote it left, it sucks.
- cutler 3y ago> cleverness like what you wrote. So we should optimise languages for users who are not prepared to familiarise themselves with the language? How is this more complicated than its commonly-used Javascript equivalent? function call(fn, val) { return fn(val) } call(n => n + 5, 10) You see when written in a language in which lambdas are first-class citizens it doesn't look clever at all so maybe Python's sad implementation of lambdas and its anti-fp culture could be at fault?