forked from kanaka/mal
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmal_func.pas
More file actions
57 lines (44 loc) Β· 1.1 KB
/
mal_func.pas
File metadata and controls
57 lines (44 loc) Β· 1.1 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
unit mal_func;
interface
uses mal_types,
mal_env;
// Some general type definitions
type
TMalCallable = function (Args : TMalArray) : TMal;
type TMalFunc = class(TMal)
public
Val : TMalCallable;
Ast : TMal;
Env : TEnv;
Params : TMalList;
isMacro : Boolean;
Meta : TMal;
constructor Create(V : TMalCallable);
constructor Create(A : TMal;
E : TEnv;
P : TMalList);
constructor Clone(F : TMalFunc);
end;
////////////////////////////////////////////////////////////
implementation
constructor TMalFunc.Create(V : TMalCallable);
begin
inherited Create();
Self.Val := V;
end;
constructor TMalFunc.Create(A : TMal;
E : TEnv;
P : TMalList);
begin
inherited Create();
Self.Ast := A;
Self.Env := E;
Self.Params := P;
end;
constructor TMalFunc.Clone(F : TMalFunc);
begin
Self.Create(F.Ast, F.Env, F.Params);
Self.isMacro := F.isMacro;
Self.Meta := F.Meta;
end;
end.