Sunday, January 18, 2009

Ch2, Ex4

(a)

if <x> then <s1> else <s2> end
========>
case <x> of true then <s1> else <s2> end


(b)

case <x> of <pattern> then <s1> else <s2> end
=============>
local T in
T = {Label <x>} == {Label <pattern>}
if T then
local T in
T = {Arity <x>} == {Arity <pattern>}
if T then
<x> = <pattern>
<s1>
else <s2> end
end
else
<s2>
end
end

No comments:

Post a Comment