Differences From Artifact [6911dbe256744186]:
- File
polemy/runtime.d
- 2010-11-24 12:32:01 - part of checkin [c75f0d5f1e] on branch trunk - Enriched the runtime. a.b is now runtime error, not undefined value if the field b does not exist. Added rand(n) and gensym(). (user: kinaba) [annotate]
To Artifact [f71ff7dc6628e423]:
- File
polemy/runtime.d
- 2010-11-25 03:32:41 - part of checkin [474c4facf0] on branch trunk - Introduced makefile to build documents. sample/macro.pmy is fully reformed. print(x) now returns x, not 0. (user: kinaba) [annotate]
78 t2.set(s.data, ValueLayer, v); 78 t2.set(s.data, ValueLayer, v);
79 return t2; 79 return t2;
80 }); 80 });
81 e.addPrimitive("{}", ValueLayer, (){ 81 e.addPrimitive("{}", ValueLayer, (){
82 return new Table; 82 return new Table;
83 }); 83 });
84 // IO and others 84 // IO and others
85 e.addPrimitive("print", ValueLayer, (Value a){ writeln(a); return new In | 85 e.addPrimitive("print", ValueLayer, (Value a){ writeln(a); return a; });
86 e.addPrimitive("gensym", ValueLayer, (){ return new StrValue(freshVarNam 86 e.addPrimitive("gensym", ValueLayer, (){ return new StrValue(freshVarNam
87 auto rand = Mt19937(unpredictableSeed); 87 auto rand = Mt19937(unpredictableSeed);
88 e.addPrimitive("rand", ValueLayer, (IntValue n){ 88 e.addPrimitive("rand", ValueLayer, (IntValue n){
89 return new IntValue( uniform(0,cast(int)n.data.toInt(),rand) ); 89 return new IntValue( uniform(0,cast(int)n.data.toInt(),rand) );
90 }); 90 });
91 } 91 }