Haskell:代码随机打印出调用

时间:2013-06-26 00:25:42

标签: haskell ghc

考虑这个Haskell代码,它通过将布尔表达式混合到NAND(就像在电路板上)然后重构它来简化布尔表达式: https://gist.github.com/kvanberendonck/5862432/c3c059138701fe127e556a2ca3696fe11c091252

使用GHC 7.4.2编译时,我在Windows系统上获得以下输出:

Before:
And (Or (Not (Input 1)) (And (And (Input 2) (Input 1)) (Input 3))) (Not (Or (Inp
ut 1) (And (Input 2) (Input 4))))

Mash:
Nand (Nand (Nand (Nand (Nand (Input 1) (Input 1)) (Nand (Input 1) (Input 1))) (N
and (Nand (Nand (Nand (Nand (Input 2) (Input 1)) (Nand (Input 2) (Input 1))) (In
put 3)) (Nand (Nand (Nand (Input 2) (Input 1)) (Nand (Input 2) (Input 1))) (Inpu
t 3))) (Nand (Nand (Nand (Nand (Input 2) (Input 1)) (Nand (Input 2) (Input 1)))
(Input 3)) (Nand (Nand (Nand (Input 2) (Input 1)) (Nand (Input 2) (Input 1))) (I
nput 3))))) (Nand (Nand (Nand (Input 1) (Input 1)) (Nand (Nand (Nand (Input 2) (
Input 4)) (Nand (Input 2) (Input 4))) (Nand (Nand (Input 2) (Input 4)) (Nand (In
put 2) (Input 4))))) (Nand (Nand (Input 1) (Input 1)) (Nand (Nand (Nand (Input 2
) (Input 4)) (Nand (Input 2) (Input 4))) (Nand (Nand (Input 2) (Input 4)) (Nand
(Input 2) (Input 4))))))) (Nand (Nand (Nand (Nand (Input 1) (Input 1)) (Nand (In
put 1) (Input 1))) (Nand (Nand (Nand (Nand (Nand (Input 2) (Input 1)) (Nand (Inp
ut 2) (Input 1))) (Input 3)) (Nand (Nand (Nand (Input 2) (Input 1)) (Nand (Input
 2) (Input 1))) (Input 3))) (Nand (Nand (Nand (Nand (Input 2) (Input 1)) (Nand (
Input 2) (Input 1))) (Input 3)) (Nand (Nand (Nand (Input 2) (Input 1)) (Nand (In
put 2) (Input 1))) (Input 3))))) (Nand (Nand (Nand (Input 1) (Input 1)) (Nand (N
and (Nand (Input 2) (Input 4)) (Nand (Input 2) (Input 4))) (Nand (Nand (Input 2)
 (Input 4)) (Nand (Input 2) (Input 4))))) (Nand (Nand (Input 1) (Input 1)) (Nand
 (Nand (Nand (Input 2) (Input 4)) (Nand (Input 2) (Input 4))) (Nand (Nand (Input
 2) (Input 4)) (Nand (Input 2) (Input 4)))))))

After:
simpl.exe:

从我的角度来看,After: simpl.exe毫无意义。它似乎是程序调用。我无法理解发生了什么。请指教。

0 个答案:

没有答案