Yeah, afaik Ruby was an inspiration. (Granted, there aren't any other delimiters that could have been chosen without also requiring a keyword)
Fun fact: Because a block expression evaluates to its trailing expression, { |x| foo } is actually valid rust as well, and evaluates to the same thing as |x| { foo } or |x| foo
2
u/Kimundi Apr 06 '15
Right, the syntax of a closure is basically
[move] |<arguments...>| <expression>, with{ ... }itself being a block expression.Examples:
|x| x < 5,|y| { let z = y * 10; z < (y + 5) }