Arquivos
hhvm/hphp/test/quick/hh_tuples.php
T
Alok Menghrajani db9577b140 Rename strict with Hack
Strict mode was the old name. Let's avoid any confusion in the future and rename things.
2013-05-15 13:05:03 -07:00

14 linhas
243 B
PHP

<?hh
function cons<X,Y>(X $x, Y $y) : (X,Y) {
return array($x, $y);
}
function car<X,Y>((X,Y) $x): X {
return $x[0];
}
function cdr<X,Y>((X,Y) $x): Y {
return $x[1];
}
echo "1..2\n";
$v = cons("ok 1\n", "ok 2\n");
echo car($v), cdr($v);