Skip to content

Instantly share code, notes, and snippets.

@novia713
Created November 22, 2019 08:28
Show Gist options
  • Save novia713/83b7ba607eca091b2bee5356e0569f09 to your computer and use it in GitHub Desktop.
Save novia713/83b7ba607eca091b2bee5356e0569f09 to your computer and use it in GitHub Desktop.
λx.z + λy.z = λxy.z
<?php
$to_one = function($name){
echo "Hola $name \n\r";
};
$to_many = function($arr) use ($to_one) {
return array_map($to_one, $arr);
};
$to_one('Primero');
$to_many(['Segundo','Tercero']);
$double_one = function($n){
echo $n * 2 ."\n\r";
};
$double_many = function($arr) use ($double_one) {
return array_map( $double_one, $arr );
};
$double_many([3,9]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment