Skip to content

Commit

Permalink
Fix #140 - ToString[] should respect Form.
Browse files Browse the repository at this point in the history
  • Loading branch information
corywalker committed May 29, 2018
1 parent b75227c commit 7abaeb2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions expreduce/ex_expression.go
Expand Up @@ -435,6 +435,15 @@ func (this *Expression) StringForm(params ToStringParams) string {
}
}

if len(this.Parts) == 2 && isHeadSym && (
headAsSym.Name == "System`InputForm" ||
headAsSym.Name == "System`FullForm" ||
headAsSym.Name == "System`OutputForm") {
mutatedParams := params
mutatedParams.form = headAsSym.Name[7:]
return this.Parts[1].StringForm(mutatedParams)
}

// Default printing format
var buffer bytes.Buffer
buffer.WriteString(this.Parts[0].StringForm(params))
Expand Down

0 comments on commit 7abaeb2

Please sign in to comment.