public Value Evaluate(Environment environment)
        {
            var result   = new ValueList();
            var localEnv = environment.NewEnv();
            var list     = AsList.From(listExpr.Evaluate(environment));

            foreach (var listValue in list.GetValue())
            {
                localEnv.Put(identifier, listValue);
                var value = valueExpr.Evaluate(localEnv);
                if (conditionExpr != null)
                {
                    var condition = conditionExpr.Evaluate(localEnv);
                    if (!condition.IsBoolean())
                    {
                        throw new ControlErrorException(new ValueString("ERROR"), "Condition must be boolean but got " + condition.Type(),
                                                        pos);
                    }

                    if (condition.AsBoolean().GetValue())
                    {
                        result.AddItem(value);
                    }
                }
                else
                {
                    result.AddItem(value);
                }
            }

            return(result);
        }
        public Value Evaluate(Environment environment)
        {
            var result   = new ValueSet();
            var localEnv = environment.NewEnv();
            var list1    = AsList.From(listExpr1.Evaluate(environment)).GetValue();
            var list2    = AsList.From(listExpr2.Evaluate(environment)).GetValue();

            for (var i = 0; i < Math.Max(list1.Count, list2.Count); i++)
            {
                localEnv.Put(identifier1, i < list1.Count ? list1[i] : ValueNull.NULL);
                localEnv.Put(identifier2, i < list2.Count ? list2[i] : ValueNull.NULL);
                var value = valueExpr.Evaluate(localEnv);
                if (conditionExpr != null)
                {
                    var condition = conditionExpr.Evaluate(localEnv);
                    if (!condition.IsBoolean())
                    {
                        throw new ControlErrorException(new ValueString("ERROR"),
                                                        "Condition must be boolean but got " + condition.Type(),
                                                        pos);
                    }

                    if (condition.AsBoolean().GetValue())
                    {
                        result.AddItem(value);
                    }
                }
                else
                {
                    result.AddItem(value);
                }
            }

            return(result);
        }