-
Notifications
You must be signed in to change notification settings - Fork 25
/
builtin_atoms.go
33 lines (32 loc) · 875 Bytes
/
builtin_atoms.go
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
package expreduce
func getAtomsDefinitions() (defs []Definition) {
defs = append(defs, Definition{
Name: "Rational",
legacyEvalFn: func(this *Expression, es *EvalState) Ex {
if len(this.Parts) != 3 {
return this
}
nAsInt, nIsInt := this.Parts[1].(*Integer)
dAsInt, dIsInt := this.Parts[2].(*Integer)
if nIsInt && dIsInt {
return NewRational(nAsInt.Val, dAsInt.Val).Eval(es)
}
return this
},
})
defs = append(defs, Definition{Name: "String"})
defs = append(defs, Definition{Name: "Real"})
defs = append(defs, Definition{Name: "Integer"})
defs = append(defs, Definition{Name: "IntegerQ"})
defs = append(defs, Definition{
Name: "Im",
OmitDocumentation: true,
ExpreduceSpecific: true,
})
defs = append(defs, Definition{
Name: "Re",
OmitDocumentation: true,
ExpreduceSpecific: true,
})
return
}