by inopinatus · 5y ago · 0 comments
y = -> f {
-> g { g[g] } [
-> g { f[-> v { g[g][v] }] }
]
}
/ see ya later.Or, in prose form: I don't see anyone disagreeing that Ruby & Python are dissimilar both in principle and in practice, but "Ruby doesn't even have first-class functions" was most unreservedly an epic howler, and once played, folks were inevitably gonna have some fun passing that football around, and despite most of the changelog from 1995 being in Japanese there are nevertheless references to lambdas that early on, although the more concise "stabby" syntax didn't rear up until ca.2008.
RECORD SCRATCH. THE ROOM FALLS SILENT.
NARRATOR: A common assumption, but no. Equating object methods to functions is a furphy. The argument along the lines of:
"Ruby's object methods are Ruby's functions, but you can't pass them around, ergo they're not functions"
is using the term "function" in two different ways, but assuming they're the same; this is not an argument based on substance, but upon mislabelling. The conclusion is bogus because the premise is bogus.
It may arise from a category error, assuming that the thing depends intrinsically upon the literal representation of the thing, or (worse) the common name of the thing, but this is a) wrong anyway, and b) loses coherence entirely in a language in which function literals can be conjured and lexically rebound at runtime.
In actuality, Ruby's lambdas are functions, and first-class, by the only definition with substance: they are closures capable of higher-order expression, taking functions as parameters when invoked, and returning functions as results.
Which is why saying "it don't have them" on a forum named after a fixed-point combinator is to invite: a) ridicule, and b) lambda calculus expressions in rap battle form.
CROWD: Yeah!
MUSIC STARTS / GLITTERBALL CLOSEUP