kiwi
kiwi copied to clipboard
Feature - Concise Lambda Expressions
As a developer, I would like a more concise way to define lambdas.
Here is how it's currently done:
key_lines = lines.select(with (line) do return line.contains("path") end).map(with (line) do return line.trim() end)
Here are some suggestions:
# arrow functions (one liners, => is syntactic sugar for `do return`)
key_lines = lines.select(with (line) => line.contains("path")).map(with (line) => line.trim())
# I kinda like this.
key_lines = with line in lines select(line.contains("path")).map(line.trim())
# The $ throws me off, but currently $ is an unused operator. (shrug)
key_lines = lines.select($.contains("path")).map($.trim())