Skip to content

Commit

Permalink
Use Ex constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
cekdahl committed Oct 1, 2017
1 parent bf685cd commit 4b8fcd6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions expreduce/builtin_functional.go
Expand Up @@ -39,7 +39,7 @@ func parseSymbol(part Ex) (symbol *Symbol, isSymbol bool) {
func parseInfinity(part Ex, es *EvalState) bool {
symbol, isSymbol := parseSymbol(part)
if isSymbol {
return symbol.IsEqual(&Symbol{Name:"System`Infinity"}, &es.CASLogger) == "EQUAL_TRUE"
return symbol.IsEqual(NewSymbol("System`Infinity"), &es.CASLogger) == "EQUAL_TRUE"
}
return false
}
Expand All @@ -48,9 +48,9 @@ func parseNegativeInfinity(part Ex, es *EvalState) bool {
expr, isExpr := parseExpression(part)
if isExpr {
template := NewExpression([]Ex{
&Symbol{Name:"System`Times"},
&Integer{Val:big.NewInt(-1)},
&Symbol{Name:"System`Infinity"},
NewSymbol("System`Times"),
NewInt(-1),
NewSymbol("System`Infinity"),
})
return expr.IsEqual(template, &es.CASLogger) == "EQUAL_TRUE"
}
Expand Down Expand Up @@ -135,7 +135,7 @@ func parseLevelSpec(this Ex, es *EvalState) levelSpec{
}

//If the head of the expression is not List, return false
expression, isList := headExAssertion(expression, &Symbol{Name:"System`List"}, &es.CASLogger)
expression, isList := headExAssertion(expression, NewSymbol("System`List"), &es.CASLogger)
if !isList {
return levelSpec{false, false, 1, 1, false}
}
Expand Down Expand Up @@ -285,7 +285,7 @@ func wrapWithHead(head Ex, expr Ex, partList []int64) *Expression {
}

func wrapWithHeadIndexed(head Ex, expr Ex, partList []int64) *Expression {
partSpec := []Ex{&Symbol{Name:"System`List"}}
partSpec := []Ex{NewSymbol("System`List")}
for _, part := range partList {
partSpec = append(partSpec, NewInt(part))
}
Expand Down

0 comments on commit 4b8fcd6

Please sign in to comment.