More importantly (and annoyingly), if I define a top-level method with def—let’s call those top-level def methods (TLDMs)—Ruby won’t let me pass it as a block to any other method. (TLDMs actually belong to an object, so strictly speaking, this makes sense. It’s still annoying.) In Python, we can pass lambdas and TLDMs like they’re identical. ... This is a problem because Python treats methods and functions differentl…
I don't think so, select is just a filter. List comprehensions map and select at the same time. Regarding TLDMs, how do you propose mapping a TLDM over an array? For example: def transform(x) # implementation ... end list = [1, 2, 3] # doesn't work ... list.map &transform Edit : &method(:transform) is way too verbose compared with Python's solution
alias :m :method
<3 <3 <3