Beispiel #1
0
        public IEnumerator <ElaValue> GetEnumerator()
        {
            ElaList xs = this;

            while (xs != Empty)
            {
                yield return(xs.InternalValue);

                var tl = xs.Tail().Ref;
                xs = tl as ElaList;

                if (xs == null)
                {
                    throw InvalidDefinition();
                }
            }
        }
Beispiel #2
0
        internal int GetLength()
        {
            ElaList xs    = this;
            var     count = 0;

            while (xs != Empty)
            {
                count++;

                var tl = xs.Tail().Ref;
                xs = tl as ElaList;

                if (xs == null)
                {
                    throw InvalidDefinition();
                }
            }

            return(count);
        }