AjErl.Expressions.ListExpression.HasVariable C# (CSharp) Method

HasVariable() public method

public HasVariable ( ) : bool
return bool
        public bool HasVariable()
        {
            foreach (var expr in this.expressions)
                if (expr.HasVariable())
                    return true;

            return false;
        }

Usage Example

Ejemplo n.º 1
0
        public void CreateSimpleList()
        {
            Context context = new Context();
            var expr = new ListExpression(new IExpression[] { new ConstantExpression(1), new AtomExpression(new Atom("x")), new AtomExpression(new Atom("y")) });

            Assert.IsFalse(expr.HasVariable());

            var result = expr.Evaluate(context, true);

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(List));

            var list = (List)result;

            Assert.IsNotNull(list.Head);
            Assert.IsNotNull(list.Tail);

            Assert.AreEqual("[1,x,y]", list.ToString());
        }
All Usage Examples Of AjErl.Expressions.ListExpression::HasVariable