func (r *REPL) Next() (ret wdte.Func, err error) {
	defer func() {
		switch e := recover().(type) {
		case error:
			err = e
		case nil:
		default:
			panic(e)
		}
	}()
	src, err := r.next()
	if err != nil {
		if err == io.EOF {
			err = nil
		}
		return nil, err
	}
	stack, partial := Partial(bytes.NewReader(src), r.stack, r.macros)
	r.stack = stack
	if partial {
		r.buf = append(r.buf, src...)
		return nil, ErrIncomplete
	}
	src = append(r.buf, src...)
	r.buf = r.buf[:0]
	m, err := wdte.Parse(bytes.NewReader(src), r.im, r.macros)
	if err != nil {
		return nil, err
	}
	frame := wdte.F().WithScope(r.Scope)
	next, ret := m.Collect(frame)
	if err, ok := ret.(error); ok {
		return nil, err
	}
	r.Scope = r.Scope.Sub(next)
	return ret.Call(frame), nil
}
Next reads and evaluates the next line of input. It returns the
value returned from that line, or an error if one is encountered.
If the end of the input has been reached, it will return nil, nil.

If an input ends in a partial expression, such as a single line of
a mult-line expression, nil, ErrIncomplete is returned.
package repl
import (
	"bufio"
	"bytes"
	"errors"
	"io"
	"github.com/DeedleFake/wdte"
	"github.com/DeedleFake/wdte/scanner"
)
var (
	ErrIncomplete = errors.New("input incomplete")
)
type NextFunc func() ([]byte, error)
func SimpleNext(r io.Reader) NextFunc {
	s := bufio.NewScanner(r)
	return func() ([]byte, error) {
		more := s.Scan()
		if !more {
			err := s.Err()
			if err != nil {
				err = io.EOF
			}
			return nil, err
		}
		return s.Bytes(), nil
	}
}
type REPL struct {
	Scope *wdte.Scope
	next   NextFunc
	im     wdte.Importer
	macros scanner.MacroMap
	stack []string
	buf   []byte
}
func New(next NextFunc, im wdte.Importer, macros scanner.MacroMap, start *wdte.Scope) *REPL {
	return &REPL{
		next:   next,
		im:     im,
		macros: macros,
		Scope:  start,
	}
}