[ prog / sol / mona ]

prog


Monads,Async/Await : Algebraic Effects in C99

27 2021-01-14 17:11

>>26 its possible to write the roll function inline too.
#include "Util/void.h"
#define roll(r) condelse("c",(r<0.3,"a"),(r>0.5,"b"))
#define roll2(r) condelse("c",(r<0.1,"a"),(r>0.3,"b"))
#define rollx(func) ({atype q1=__rdtsc();func(uintdouble01(randomize(q1))); })
#define rolly1(r,args...) ({ condelse(args);})
#define rolly(args...) ({ atype q1=__rdtsc();\
float r=(uintdouble01(randomize(q1)));\
rolly1(r,args) ;})
int main(){print(rolly("c",(r<0.1,"a"),(r>0.3,"b")) );}

69


VIP:

do not edit these