fix: no stringify in hot loop
This commit is contained in:
@@ -41,10 +41,14 @@ func main() {
|
||||
// Turn tokens into syntax tree.
|
||||
expression, err := saccharine.Parse(tokens)
|
||||
cli.HandleError(err)
|
||||
logger.Info("parsed syntax tree", "tree", saccharine.Stringify(expression))
|
||||
if options.Verbose {
|
||||
logger.Info("parsed syntax tree", "tree", saccharine.Stringify(expression))
|
||||
}
|
||||
|
||||
compiled := convert.SaccharineToLambda(expression)
|
||||
logger.Info("compiled lambda expression", "tree", lambda.Stringify(compiled))
|
||||
if options.Verbose {
|
||||
logger.Info("compiled lambda expression", "tree", lambda.Stringify(compiled))
|
||||
}
|
||||
|
||||
// Reduce expression.
|
||||
start := time.Now()
|
||||
@@ -56,7 +60,9 @@ func main() {
|
||||
steps := 0
|
||||
|
||||
for lambda.ReduceOnce(&compiled) {
|
||||
logger.Info("reduction", "tree", lambda.Stringify(compiled))
|
||||
if options.Verbose {
|
||||
logger.Info("reduction", "tree", lambda.Stringify(compiled))
|
||||
}
|
||||
if options.Explanation {
|
||||
fmt.Println(" =", lambda.Stringify(compiled))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user