Skip to content

Instantly share code, notes, and snippets.

@miura1729
Created January 15, 2011 12:43
Show Gist options
  • Save miura1729/780886 to your computer and use it in GitHub Desktop.
Save miura1729/780886 to your computer and use it in GitHub Desktop.
YTL::define_macro :foo do |x|
if x == 0 then
x
else
1
end
end
このmacroの本体が次のようなRubyプログラムに変換されます、。
{ | x |
state = 0
while true
case state
when 0
state = 1
when 1
if x .==(0) then
state = 3
else
state = 2
end
when 2
state = 4
value = 1
when 4
return value
when 3
return x
state = 2
end
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment