func Enumerate(frame wdte.Frame, args ...wdte.Func) wdte.Func {
	frame = frame.Sub("enumerate")
	switch len(args) {
	case 0:
		return wdte.GoFunc(Enumerate)
	}
	s := args[0].(Stream)
	var i wdte.Number
	return NextFunc(func(frame wdte.Frame) (wdte.Func, bool) {
		frame = frame.Sub("enumerate")
		n, ok := s.Next(frame)
		if !ok {
			return nil, false
		}
		r := wdte.Array{i, n}
		i++
		return r, true
	})
}
Enumerate is a WDTE function with the following signature:

enumerate s

It returns a Stream which yields values of the form [i; v] where i
is the zero-based index of the element v that was yielded by the
Stream s.
package stream
import (
	"github.com/DeedleFake/wdte"
	"github.com/DeedleFake/wdte/wdteutil"
)
func Map(frame wdte.Frame, args ...wdte.Func) (mapper wdte.Func) {
	switch len(args) {
	case 0:
		return wdte.GoFunc(Map)
	}
	f := args[0]
	return wdte.GoFunc(func(frame wdte.Frame, args ...wdte.Func) wdte.Func {
		switch len(args) {
		case 0:
			return mapper
		}
		s := args[0].(Stream)
		return NextFunc(func(frame wdte.Frame) (wdte.Func, bool) {
			n, ok := s.Next(frame)
			if !ok {
				return nil, false
			}
			return f.Call(frame.Sub("map"), n), true
		})
	})
}
func Filter(frame wdte.Frame, args ...wdte.Func) (filter wdte.Func) {
	switch len(args) {
	case 0:
		return wdte.GoFunc(Filter)
	}
	f := args[0]
	return wdte.GoFunc(func(frame wdte.Frame, args ...wdte.Func) wdte.Func {
		switch len(args) {
		case 0:
			return filter
		}
		s := args[0].(Stream)
		return NextFunc(func(frame wdte.Frame) (wdte.Func, bool) {
			for {
				n, ok := s.Next(frame)
				if !ok {
					return nil, false
				}
				if f.Call(frame.Sub("filter"), n) == wdte.Bool(true) {
					return n, true
				}
			}
		})
	})
}
func FlatMap(frame wdte.Frame, args ...wdte.Func) (mapper wdte.Func) {
	switch len(args) {
	case 0:
		return wdte.GoFunc(FlatMap)
	}
	f := args[0]
	return wdte.GoFunc(func(frame wdte.Frame, args ...wdte.Func) wdte.Func {
		switch len(args) {
		case 0:
			return mapper
		}
		s := args[0].(Stream)
		var cur Stream
		return NextFunc(func(frame wdte.Frame) (wdte.Func, bool) {
			for {
				if cur != nil {
					n, ok := cur.Next(frame)
					if ok {
						return n, true
					}
					cur = nil
				}
				n, ok := s.Next(frame)
				if !ok {
					return nil, false
				}
				r := f.Call(frame, n)
				if r, ok := r.(Stream); ok {
					cur = r
					continue
				}
				return r, true
			}
		})
	})
}