-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuiltins.fs
More file actions
120 lines (114 loc) · 3.73 KB
/
builtins.fs
File metadata and controls
120 lines (114 loc) · 3.73 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
module Builtins
open Inc
open IncTypes
open Utils
open ImmutableCollections
let init() =
let _builtins =
[
".", Special(InterOp)
"*", Function(Multiply)
"/", Function(Divide)
"%", Function(Modulus)
"+", Function(Add)
"-", Function(Subtract)
"=", Function(Equal)
"==", Function(Equal) // needs review
"!=", Function(NotEqual)
">", Function(Greater)
"<", Function(Less)
"add-watch", Special(AddWatch)
"alter", Special(Alter)
"agent", Special(DefAgent)
"apply", Special(ApplyTo)
"assoc*", Function(Assoc)
"atom", Function(DefAtom)
"binding", Special(Binding)
"cat", Function(Cat)
"char?", Function(IsChar)
"cond", Special(Cond)
"conj", Function(Conjoin)
"cons", Function(Cons)
"contains?", Function(IncContains)
"count", Function(Count)
"debug", Special(Debug)
"def", Special(Define)
"deref", Function(Deref)
"delay", Special(MakeDelay)
"display", Function(Display)
"dissoc1", Function(Dissoc)
"do", Special(Begin)
"dosync", Special(DoSync)
"eval", Special(Eval)
"first", Function(IncFirst)
"find", Function(Find)
"find-ns", Function(FindNS)
"fn*", Special(FnStar)
"force", Function(Force)
"gensym", Function(GenSym)
"get", Function(Get)
"if", Special(If)
"int", Function(CoerceToInt)
"in-ns", Function(ChangeNS)
"key", Function(Key)
"keys", Function(Keys)
"keyword", Function(MakeKeyword)
"keyword?", Function(IsKeyword)
"lambda", Special(Lambda)
"lazy-seq", Special(LazySeq)
"let*", Special(LetStar)
"list", Special(MakeList)
"load", Function(Load)
"loop*", Special(Loop)
"make-map", Function(MakeMap)
"map?", Function(IsMap)
"meta", Function(Meta)
"monitor-enter", Function(MonitorEnter)
"monitor-exit", Function(MonitorExit)
"new", Special(New)
"next", Function(IncNext)
"nil?", Function(IsNil)
"ns-unmap", Function(UnDef)
"nth", Function(Nth)
"partial", Special(Partial)
"peek", Function(Peek)
"pop", Function(Pop)
"print", Function(Print)
"quote", Special(Quote)
"re-pattern", Function(RePattern)
"re-match", Function(ReMatcher)
"recur", Special(Recur)
"ref", Function(DefRef)
"rest", Function(IncRest)
"reverse", Function(Reverse)
"send", Special(Send)
"send-off", Special(Send)
"seq", Function(IncSeq)
"seq?", Function(IsSeq)
"seqable?", Function(IsSeqable)
"set-macro", Special(SetMacro)
"set-validator", Function(SetValidator)
"set!", Special(Assign)
"str", Function(Str)
"string?", Function(IsString)
"symbol", Function(MakeSymbol)
"symbol?", Function(IsSymbol)
"syntax-quote", Special(SyntaxQuote)
"throw", Special(Throw)
"try", Special(Try)
"unquote", Special(UnQuote)
"val", Function(Val)
"vals", Function(Vals)
"var", Special(GetVar)
"vec", Function(MakeVector)
"vector?", Function(IsVector)
"with-meta", Function(WithMeta)
]
for nm,e in _builtins do
let m = IncMap.ofPairs(
[ (kwd("name"), sym(nm));
(kwd("ns"), NS(Globals.CoreNS) |> e2v);
(kwd("file"), str("__builtin__"));
(kwd("doc"), str(""))])
let v = IncValue.OfExpr(e,m)
Globals.CoreNS.Intern(nm,v,Some(m)) |> ignore