13.01.2015 Views

lambda-cálculo no tipado - QueGrande

lambda-cálculo no tipado - QueGrande

lambda-cálculo no tipado - QueGrande

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

RECURSIVIDAD<br />

La función iseven devuelve true si se aplica a un número par y false en caso contrario:<br />

<br />

Fix <strong>no</strong> funciona con nuestro sistema de tipos actual. Solución:<br />

Ejercicio: definir equals, plus, times y factorial usando fix.<br />

Equals:<br />

equals_aux = λf : Nat → Nat → Bool.<br />

λx : Nat. λy : Nat.<br />

if iszero x then iszero y<br />

else if iszero y then false<br />

else f (pred x) (pred y);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!