Skip to content

Instantly share code, notes, and snippets.

@fumieval
Created July 7, 2012 07:49
Show Gist options
  • Select an option

  • Save fumieval/3065301 to your computer and use it in GitHub Desktop.

Select an option

Save fumieval/3065301 to your computer and use it in GitHub Desktop.
{
https://twitter.com/its_out_of_tune/status/221500817616805890 (´・ω・`)すんません。広義の意味で「オブジェクト」と言ったでつ。関数はファーストクラスオブジェクトでしょうか?
https://twitter.com/kuina_tesso/status/221503452851871744 @its_out_of_tune ほぼ、そうであるといえますね。
ならば、これが動くはずだ。
}
func fix(f)
{the simplest implementation of fixed point combinator}
func g(arg)
return f(fix(f))(arg) {戻り値の返し方が不明}
end func
return g
end func
func fact_f(self)
func f(n)
if (n = 0)
return 1
end if
return n * self(n - 1)
end func
return f
end func
func Main()
let Log@WriteLn(fix(fact_f)(5))
end func
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment