Mjahaja
This commit is contained in:
@ -26,6 +26,7 @@ If you want to use Haskell then there is also a wrapper module ([[https://chalme
|
|||||||
(code =<< code (parse "\\x. x"))))
|
(code =<< code (parse "\\x. x"))))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
\newpage
|
||||||
* Exercises
|
* Exercises
|
||||||
In order to pass this assignment you have to get at least four points.
|
In order to pass this assignment you have to get at least four points.
|
||||||
|
|
||||||
@ -85,7 +86,7 @@ Test your implementation. Here are some test cases that must work:
|
|||||||
| ~z~ | $C(\lambda z . z)$ | $\text{case}\ z\ \text{of}\ \{ C(z) \rightarrow z \}$ | $\text{case}\ C(\lambda z. z) \ \text{of}\ \{ C(z) \rightarrow z \}$ |
|
| ~z~ | $C(\lambda z . z)$ | $\text{case}\ z\ \text{of}\ \{ C(z) \rightarrow z \}$ | $\text{case}\ C(\lambda z. z) \ \text{of}\ \{ C(z) \rightarrow z \}$ |
|
||||||
|
|
||||||
*** Answer
|
*** Answer
|
||||||
See =Assignment.hs=.
|
See =Main.hs=.
|
||||||
|
|
||||||
** (1p)
|
** (1p)
|
||||||
Implement multiplication of natural numbers in $\chi$, using the representation of natural numbers given in the $\chi$ specification.
|
Implement multiplication of natural numbers in $\chi$, using the representation of natural numbers given in the $\chi$ specification.
|
||||||
@ -131,4 +132,4 @@ Test your implementation, for instance by testing that addition (defined in the
|
|||||||
Note that implementing a call-by-value semantics properly in a language like Haskell, which is by default non-strict, can be tricky. However, you will not fail if the only problem with your implementation is that some programs that should fail to terminate instead terminate with a “reasonable” result.
|
Note that implementing a call-by-value semantics properly in a language like Haskell, which is by default non-strict, can be tricky. However, you will not fail if the only problem with your implementation is that some programs that should fail to terminate instead terminate with a “reasonable” result.
|
||||||
|
|
||||||
*** Answer
|
*** Answer
|
||||||
See =Assignment.hs=.
|
See =Main.hs=.
|
||||||
@ -3,7 +3,7 @@ module Main where
|
|||||||
|
|
||||||
import Chi
|
import Chi
|
||||||
import Data.Functor ( (<&>) )
|
import Data.Functor ( (<&>) )
|
||||||
import Control.Monad.Identity (Identity(runIdentity))
|
import Control.Monad.Identity ( Identity( runIdentity ) )
|
||||||
|
|
||||||
-- Task 3
|
-- Task 3
|
||||||
subst :: Variable -> Exp -> Exp -> Exp
|
subst :: Variable -> Exp -> Exp -> Exp
|
||||||
|
|||||||
Reference in New Issue
Block a user