Lambda

Overview

lambdas are anonymous functions.

The syntax to create them is simple:

\ variable0 variable1 ... {  your code here }

You can even use it to

Call a function just once

\ i { <<< "passed '", i, "'" >>>; }(3);

Use case

Passing to a function pointer

funcdef void fptr_t(int);
\ i { <<< "passed '", i, "'" >>>; } => var fptr_t fptr;
fptr(4);

As Argument to Functions

funcdef void fptr_t(int);
fun void test(fptr_t fptr) {
   fptr(5);
}
test(\ i { <<< "passed '", i, "'" >>>; });
built with mdBook
You'll find the source here, Luke!