RosettaCodeData/Task/Introspection/Zkl/introspection-2.zkl
2017-09-25 22:28:19 +02:00

5 lines
241 B
Text

var n=3, x=1.0, a=5, z="zoo";
self.vars; --> L(L("a",5),L("n",3),L("x",1),L("z","zoo"))
sum:=self.vars.reduce(fcn(p,[(nm,v)],r){
if((1).isType(v)){r.inc();p+v;} else p},0,num:=Ref(0));
println("Num int vars = ",num.value,". Sum = ",sum);