Skip to content

Commit

Permalink
Fix: Traditional and standart form of strings should not include quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
corywalker committed May 29, 2018
1 parent 7abaeb2 commit fd53381
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions expreduce/evalstate.go
Expand Up @@ -90,6 +90,8 @@ func (es *EvalState) Init(loadAllDefs bool) {
es.MarkSeen("System`InputForm")
es.MarkSeen("System`OutputForm")
es.MarkSeen("System`FullForm")
es.MarkSeen("System`TraditionalForm")
es.MarkSeen("System`StandardForm")

es.MarkSeen("System`ESimpleExamples")
es.MarkSeen("System`EFurtherExamples")
Expand Down
2 changes: 2 additions & 0 deletions expreduce/ex_expression.go
Expand Up @@ -438,6 +438,8 @@ func (this *Expression) StringForm(params ToStringParams) string {
if len(this.Parts) == 2 && isHeadSym && (
headAsSym.Name == "System`InputForm" ||
headAsSym.Name == "System`FullForm" ||
headAsSym.Name == "System`TraditionalForm" ||
headAsSym.Name == "System`StandardForm" ||
headAsSym.Name == "System`OutputForm") {
mutatedParams := params
mutatedParams.form = headAsSym.Name[7:]
Expand Down
4 changes: 3 additions & 1 deletion expreduce/ex_string.go
Expand Up @@ -12,7 +12,9 @@ func (this *String) Eval(es *EvalState) Ex {
}

func (this *String) StringForm(params ToStringParams) string {
if params.form == "OutputForm" {
if (params.form == "OutputForm" ||
params.form == "TraditionalForm" ||
params.form == "StandardForm") {
return fmt.Sprintf("%v", this.Val)
}
return fmt.Sprintf("\"%v\"", this.Val)
Expand Down

0 comments on commit fd53381

Please sign in to comment.