Skip to content

Instantly share code, notes, and snippets.

@adambard
Created May 4, 2012 03:28
Show Gist options
  • Save adambard/2591773 to your computer and use it in GitHub Desktop.
Save adambard/2591773 to your computer and use it in GitHub Desktop.
Recursive anonymous factorial in MATLAB, using functools.
fact = functools.Y(@(self) @(n) ...
functools.if(n < 2,...
@() 1,
@() n * self(n - 1));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment