-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbug.d
More file actions
42 lines (31 loc) · 706 Bytes
/
bug.d
File metadata and controls
42 lines (31 loc) · 706 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/+int main(){
//float f = float.infinity;
int i = 0;
assert(0 == 0x80000000);
return 0;
}+/
//int
/+string toEngNum(uint i){
if(i>=1000) return toEngNum(i/1000)~" thousand"~(i%100?" "~toEngNum(i%1000):"");
}+/
/+import std.stdio;
import std.string, std.algorithm;
mixin template Mem(string s){
enum _vars = s.split(",");
static _lambda(string[] a){
string[2][] r;
foreach(x;a){
auto y = a.split(" ");
r~=cast(string[2])y;
}
return r;
}
enum _tn = _lambda(_vars);
mixin(_vars.join(";")~";");
}
class Term{}
class Id: Term{mixin Mem!q{string name};}
class Ap: Term{mixin Mem!q{Term term1,Term term2};}
class Lam: Term{mixin Mem!q{string var,Term term};}
void main(){
}+/