File tree 2 files changed +132
-54
lines changed
2 files changed +132
-54
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,9 @@ fibonacci = [r|
69
69
|]
70
70
71
71
72
+ printCS :: CL -> IO ()
73
+ printCS cl = putStrLn (" code size: " ++ show (codeSize cl))
74
+
72
75
-- data CL = Com Combinator | INT Integer | CL :@ CL
73
76
codeSize :: CL -> Int
74
77
codeSize (Com _) = 1
@@ -87,43 +90,43 @@ showCompilations source = do
87
90
let expr = compileBracket env
88
91
putStrLn " The main expression compiled to SICKBY combinator expressions by recursice bracket abstraction:"
89
92
print expr
90
- print $ codeSize expr
93
+ printCS expr
91
94
putStrLn " "
92
95
93
96
putStrLn " applying plain Kiselyov compilation:"
94
97
print $ compilePlain env
95
- print $ codeSize $ compilePlain env
98
+ printCS $ compilePlain env
96
99
putStrLn " "
97
100
98
101
let exprK = compileK env
99
102
putStrLn " The main expression compiled to SICKBY combinator expressions with K-optimization:"
100
103
print exprK
101
- print $ codeSize exprK
104
+ printCS exprK
102
105
putStrLn " "
103
106
104
107
105
108
let expr' = compileEta env
106
109
putStrLn " The main expression compiled to SICKBY combinator expressions with Eta-optimization:"
107
110
print expr'
108
- print $ codeSize expr'
111
+ printCS expr'
109
112
putStrLn " "
110
113
111
114
let expr'' = compileBulk env
112
115
putStrLn " The main expression compiled to SICKBY combinator expressions with bulk combinators:"
113
116
print expr''
114
- print $ codeSize expr''
117
+ printCS expr''
115
118
putStrLn " "
116
119
117
120
let expr''' = compileBulkLinear env
118
121
putStrLn " The main expression compiled to SICKBY combinator expressions with bulk combinators and linear elimination:"
119
122
print expr'''
120
- print $ codeSize expr'''
123
+ printCS expr'''
121
124
putStrLn " "
122
125
123
126
let expr'''' = compileBulkLog env
124
127
putStrLn " The main expression compiled to SICKBY combinator expressions with bulk combinators and logarithmic elimination:"
125
128
print expr''''
126
- print $ codeSize expr''''
129
+ printCS expr''''
127
130
putStrLn " "
128
131
129
132
You can’t perform that action at this time.
0 commit comments