diff --git a/expr/build.go b/expr/build.go index 519759a..3cc5637 100644 --- a/expr/build.go +++ b/expr/build.go @@ -52,6 +52,11 @@ func (bctx BuildCtx) buildExprTill(e Expr, fn func(e Expr) bool) Expr { ea[i] = bctx.buildExprTill(ea[i], fn) } return ea + case List: + for i := range ea { + ea[i] = bctx.buildExprTill(ea[i], fn) + } + return ea default: panicf("type %T can't express a value", ea) } diff --git a/expr/expr.go b/expr/expr.go index dfb2869..8ef915a 100644 --- a/expr/expr.go +++ b/expr/expr.go @@ -139,6 +139,26 @@ func (tup Tuple) equal(e equaler) bool { //////////////////////////////////////////////////////////////////////////////// +// List represents an ordered set of Exprs, all of the same type. A List's size +// does not affect its type signature, unlike a Tuple +type List []Expr + +// NewList returns a List around the given list of Exprs +func NewList(ee ...Expr) List { + return List(ee) +} + +func (l List) String() string { + return "[" + exprsJoin(l) + "]" +} + +func (l List) equal(e equaler) bool { + ll, ok := e.(List) + return ok && exprsEqual(l, ll) +} + +//////////////////////////////////////////////////////////////////////////////// + // Statement represents an actual action which will be taken. The input value is // used as the input to the pipe, and the output of the pipe is the output of // the statement