Logo

Programming-Idioms

  • Python
  • C++

Idiom #93 Pass a runnable procedure as parameter

Implement the procedure control which receives one parameter f, and runs f.

void control(invocable auto&& f)
{
 f();
}
from typing import Callable
def control(f: Callable): f()
def control(f):
    f()
procedure Control (F : access procedure) is
begin
   F.all;
end Control;

New implementation...
< >
programming-idioms.org