moved all math functions and operators to funcalls

So now if you want to add a new operator or math function all you have
to do is to add it to func.go. Conpletion will be generated from it.
This commit is contained in:
2023-11-05 12:55:59 +01:00
parent 5189d351c6
commit c4c60651d1
4 changed files with 243 additions and 235 deletions

View File

@@ -115,20 +115,20 @@ func (s *Stack) Shift(num ...int) {
}
}
// just return the last item, do not remove it
// Return the last num items from the stack w/o modifying it.
func (s *Stack) Last(num ...int) []float64 {
items := []float64{}
i := s.Len()
count := 1
var items []float64
if len(num) > 0 {
count = num[0]
}
if s.linklist.Back() == nil {
return nil
}
for i := 0; i < count; i++ {
items = append(items, s.linklist.Back().Value.(float64))
for e := s.linklist.Front(); e != nil; e = e.Next() {
if i <= count {
items = append(items, e.Value.(float64))
}
i--
}
return items