Project

General

Profile

Actions

Bug #16976

closed

Documentation bug in Proc

Added by kwerle (Kurt Werle) over 4 years ago. Updated over 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:98912]

Description

https://ruby-doc.org/core-2.7.0/Proc.html

About 1/3 of the way through the docs, it states:

Lambda semantics is typically preserved during the proc lifetime, including &-deconstruction to a block of code:

p = proc {|x, y| x }
l = lambda {|x, y| x }
[[1, 2], [3, 4]].map(&p) #=> [1, 2]
[[1, 2], [3, 4]].map(&l) # ArgumentError: wrong number of arguments (given 1, expected 2)

The 3rd line of code should be:

[[1, 2], [3, 4]].map(&p) #=> [1, 3]

Updated by jeremyevans0 (Jeremy Evans) over 4 years ago

Thanks for the report! I'll fix the documentation shortly.

Updated by jeremyevans0 (Jeremy Evans) over 4 years ago

  • Status changed from Open to Closed

This was fixed earlier in 39a1959d289ecba5e61431deaef239123c3f0fcc. I don't consider it worth backporting.

Actions

Also available in: Atom PDF

Like0
Like0Like0