[ prog / sol / mona ]

prog


Monads,Async/Await : Algebraic Effects in C99

48 2021-01-15 12:15

#include "Util/void.h"
#define prefix2(a) (r detuple(a) )
#define rolls2(v,args...) ({double r=v;\
condif(chainapply(prefix2,args));})
int main(int argc,char**argv){
rolls2(atof(argv[1]),(0.5,print("50% chance\n")),(0.2,print("20% chance\n")),(!=-1.0,print("30% chance\n")));
// ./roll 0.5
// 50% chance

}

69


VIP:

do not edit these