Skip to content

Instantly share code, notes, and snippets.

@tetsu-miyagawa
Last active November 18, 2015 14:37
Show Gist options
  • Save tetsu-miyagawa/238708b6c9be34d1e8b1 to your computer and use it in GitHub Desktop.
Save tetsu-miyagawa/238708b6c9be34d1e8b1 to your computer and use it in GitHub Desktop.
CTMCP Section 2.9 Exercise 5
declare Test
proc {Test X}
case X
of a|Z then {Browse 'case'(1)}
[] f(a) then {Browse 'case'(2)}
[] Y|Z andthen Y==Z then {Browse 'case'(3)}
[] Y|Z then {Browse 'case'(4)}
[] f(Y) then {Browse 'case'(5)}
else {Browse 'case'(6)} end
end
{Test [b c a]}
{Test f(b(3))}
{Test f(a)}
{Test f(a(3))}
{Test f(d)}
{Test [a b c]}
{Test [c a b]}
{Test a|a}
{Test '|'(a b c)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment