diff --git a/lang/fancyfunc/fancy_func.go b/lang/fancyfunc/fancy_func.go index 163fc177a0..93470e553c 100644 --- a/lang/fancyfunc/fancy_func.go +++ b/lang/fancyfunc/fancy_func.go @@ -64,7 +64,11 @@ func (obj *FuncValue) Cmp(val types.Value) error { return errwrap.Wrapf(err, "cannot cmp types") } - return fmt.Errorf("cannot cmp funcs") // TODO: can we ? + if obj != val { // best we can do + return fmt.Errorf("different pointers") + } + + return nil } // Copy returns a copy of this value. diff --git a/lang/funcs/core/iter/map_func.go b/lang/funcs/core/iter/map_func.go index 7f916276dd..a5c0e2780f 100644 --- a/lang/funcs/core/iter/map_func.go +++ b/lang/funcs/core/iter/map_func.go @@ -60,6 +60,7 @@ type MapFunc struct { RType *types.Type // this is the type of the elements in our output list init *interfaces.Init + last types.Value // last value received to use for diff lastFuncValue *fancyfunc.FuncValue // remember the last function value lastInputListLength int // remember the last input list length @@ -627,6 +628,12 @@ func (obj *MapFunc) Stream(ctx context.Context) error { continue } + // XXX: double check this passes through function changes + if obj.last != nil && input.Cmp(obj.last) == nil { + continue // value didn't change, skip it + } + obj.last = input // store for next + value, exists := input.Struct()[mapArgNameFunction] if !exists { return fmt.Errorf("programming error, can't find edge")