[ prog / sol / mona ]

prog


Monads,Async/Await : Algebraic Effects in C99

51 2021-01-15 12:36
//with condeach(NEW), its also possible to test for multiple conditions at once
 
#include "Util/void.h"
#define prefix2(a) (r detuple(a) )
#define rolls2(v,args...) ({double r=v;\
condeach(chainapply(prefix2,args));})
int main(int argc,char**argv){
rolls2(atof(argv[1]),(==0.5,print("exactly 0.5 \n")),(>=0.2,print("more or equal to 0.2\n")),(<1.0,print("less than 1.0\n")));
/* ./roll 0.5
 exactly 0.5
 more or equal to 0.2
 less than 1.0
*/

}
69


VIP:

do not edit these