Logo

Programming-Idioms

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

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
procedure Control (F : access procedure) is
begin
   F.all;
end Control;
void control (void (*f)()) {
        (*f)();
}
void control(invocable auto&& f)
{
 f();
}
T control(Func<T> f) {
	return f();
}
void control(void function() f)
{
    f();
}
import std.traits;
void control(alias f)()
if (isCallable!f)
{
    f();
}
control(Function f) => f();
def control(f) do
	f()
end
module x
  implicit none
contains
  subroutine control(f)
    interface
       subroutine f()
       end subroutine f
    end interface
    call f
  end subroutine control
end module x
func control(f func()) {
	f()
}
void control(Closure f) {
    f()
}
control f = f
function control(f){
	f();
}
static void control(Runnable f) {
    f.run();
}
(defun control (f)
   (funcall f))
function control(f)
	f()
end
function control($f) {
    $f();
}
procedure control(f: tprocedure);
begin
  if Assigned(f) then f;
end; 
sub control {
    my $f = shift;
    $f->();
}
def control(f):
    f()
def control
    yield
end
fn control(f: impl Fn()) {
    f();
}
(define (control f) (f))