Concurrent Clean : Re: ExtendedArith, 小町算

[id:lethevert:20070815:p3]
コンパイルしてみたら、gmp.cのコンパイルで警告が。

#include

が不足しているみたいだ。

      • -

ということで、小町算をリベンジしてみた。
[id:lethevert:20070718:p2]のプログラムとほとんど変わらない。Main.iclxが整数演算版で、MainR.iclxが有理数演算版。
実行時間は2倍くらいになって、2.3秒くらい。

$ diff Main.iclx MainR.iclx
1c1
< module Main
---
> module MainR
4c4
< import StdBase, OptEnv
---
> import StdBase, OptEnv, Rational
10c10
<           |> filter (\(_,x) = x == 100)
---
>           |> filter (\(_,x) = x == toRational 100)
25c25
< eval NONE      = \x y = x * 10 + y
---
> eval NONE      = \x y = x * toRational 10 + y
36c36
< calc op = calc [1] [2,3,4,5,6,7,8,9] [] op
---
> calc op = calc [toRational 1] (map toRational [2,3,4,5,6,7,8,9]) [] op