kiwi icon indicating copy to clipboard operation
kiwi copied to clipboard

Feature - Concise Lambda Expressions

Open fuseraft opened this issue 6 months ago • 0 comments

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())

fuseraft avatar Aug 02 '24 14:08 fuseraft