From 0bc48ea8b7afda2ae660b1800b49741daeecdc3e Mon Sep 17 00:00:00 2001 From: Devin Carraway Date: Tue, 7 Aug 2018 23:36:08 -0700 Subject: [PATCH] Add ClearHistory() Allows the caller to reset the history of past evaluations. --- compute/compute.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compute/compute.go b/compute/compute.go index 15fd8d3..b8f953a 100644 --- a/compute/compute.go +++ b/compute/compute.go @@ -16,6 +16,11 @@ import ( var resHistory = []float64{} +// ClearHistory removes prior evaluation history used for @ references. +func ClearHistory() { + resHistory = []float64{} +} + func Evaluate(in string) (float64, error) { floats := NewFloatStack() ops := NewStringStack()