Skip to content

Lambda syntax achieved with C preprocessor macros

Notifications You must be signed in to change notification settings

theofabilous/clam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CLAM: Lambdas in C

#define ARRAY_SIZE(a) (sizeof a / sizeof(*a))
struct S {
    const char *name;
    int n;
} things[] = {
    { "abc", 1 },
    { "def", 8787 },
    { "z", 0 },
    { "a", 1 },
};
ARRAY_SORT(
    things,
    ARRAY_SIZE(things),
    (struct S a, struct S b) {
        yield(strcmp(a.name, b.name));
    }
);

About

Lambda syntax achieved with C preprocessor macros

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published