Re:"Useless syntax sugar": Numbered block parameters in Ruby
by drewbug01 on Wednesday October 11, 2023 @11:02AM
(#37845335)
Ruby does allow you to pass a one-parameter function as the argument to `map`:
Not precisely the same as what you've outlined, of course, but perhaps useful nonetheless.
[ Parent
| on HN ]
Re:"Useless syntax sugar": Numbered block parameters in Ruby
by inopinatus on Thursday October 12, 2023 @12:28AM
(#37853495)
Fun fact, the arity of functions generated by Symbol#to_proc is not 1 but -2 (that is, additional arguments are passed through as well), so we can write stuff like
module MissionControl
#...
[Proc, Method, Binding, UnboundMethod].each_with_object(self, &:include)
end
if one were so inclined.