Project

General

Profile

Actions

Feature #9401

open

Yet another syntax for literal anonymous functions (lambdas)

Added by alexeymuranov (Alexey Muranov) over 10 years ago. Updated over 2 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:<unknown>]

Description

Please do not be angry at me and just close this proposal if it does not look interesting. It comes from my aesthetic dissatisfaction with the ->(x){ ... } literal anonymous function notation and from my amateurish interest in lambda calculus.

Here is a yet another syntax for literal anonymous functions (lambdas) that i propose:

f = {\ x => x*x }
f[1] # => 1
f[2] # => 4

It looks a bit like a hash on purpose: i think that a hash is a "function in extension" and a lambda is a "function in intension" (see, for example, in these notes). The backslash stands for "lambda", like in Haskell.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0