型なしラムダ計算の実装を第一回の宿題とします.
変数名付きのラムダ項が String で与えられるので, 評価した上で名無し項を String で返す eval 関数を実装してください.
具体的には次のような関数になります:
eval "(\\x. \\y. x) (\\x. x)" -- -> "(\\ (\\ 0))"
ひな形は Eval.hs です. Test.hs を実行することでテストできます.
成功した場合次のようになります:
> runghc Test.hs
run
- returns (\ 0) at the 1st case
- returns (\ (\ (\ 1))) at the 2nd case
- returns (\ 0) at the 3rd case
- returns (\ (\ 1)) at the 4th case
- returns (\ (\ 0)) at the 5th case
Finished in 0.0014 seconds