From: Alexey@..., Muranov@... Date: 2014-01-13T09:14:21+00:00 Subject: [ruby-core:59738] [CommonRuby - Feature #9401] Yet another syntax for literal anonymous functions (lambdas) Issue #9401 has been updated by Alexey Muranov. Nobuyoshi Nakada wrote: > What about `(^x) {x*x}`? I think, my initial attempt was closer to lambda calculus notation `(��x(x*x))`, to its modern variant `(x|->x*x)`, to Haskell `(\x -> x*x )`, to Ruby block syntax `{|x| x*x }`, and to Ruby hash syntax `{ 2 => 2*2 }`. ---------------------------------------- Feature #9401: Yet another syntax for literal anonymous functions (lambdas) https://bugs.ruby-lang.org/issues/9401#change-44259 * Author: Alexey Muranov * Status: Open * Priority: Normal * Assignee: * Category: * Target version: ---------------------------------------- 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](http://www.classes.cs.uchicago.edu/archive/2004/spring/15300-1/docs/lambda-intro.pdf)). The backslash stands for "lambda", like in Haskell. -- http://bugs.ruby-lang.org/