4 ms·
I suspect it's more likely to be "mind blow" for experienced programmers of less dynamic languages than novice programmers. Indeed, if you start by declaring fu
by Tloewald 14y ago
I suspect it's more likely to be "mind blow" for experienced programmers of less dynamic languages than novice programmers. Indeed, if you start by declaring functions as variables you're halfway there.
The way you pass around functions in, say, PHP (or more accurately, the way PHP fakes it by using syntax sugar for eval) is a lot more confusing.
- damncabbage 14y agoPHP is terrible, but the following now is valid PHP: $addOne = function($a){ return $a + 1 }; $result = array_map($addOne, array(1,2,3)); // now [2,3,4] Or: // Reference to intval() function. $result = array_map(intval, array('1','2','a'));