view test/nest/no_closure.m @ 31247:3dae836c598c

doc: Expand and edit documentation for memoization (bug #60860)
author Arun Giridhar <arungiridhar@gmail.com>
date Fri, 30 Sep 2022 06:38:59 -0400
parents fc4bb4bd1d5e
children
line wrap: on
line source

## no_closure.m
function r = no_closure (n)
  if (ischar (n))
    r = nested (n);
  else
    if (n == 0)
      r = @no_closure;
    elseif (n == 1)
      r = @nested;
    endif
  endif
  function r = nested (x)
    if (nargin == 1)
      r = ["nested ", x];
    else
      r = "nested";
    endif
  endfunction
endfunction