Exemplo n.º 1
0
        public static IArrayFunctionInstance ToInstance(IEnumerable <IFunctionInstance> enumerable)
        {
            IArrayFunctionInstance tail = ArrayTailFunction.Instance;

            foreach (IFunctionInstance t in enumerable.Reverse())
            {
                tail = new ArrayHeadTailFunctionInstance(t, tail);
            }
            return(tail);
        }
        public IEnumerable <T> ValueEnumerable <T> (TermType target)
        {
            yield return((T)this.term.ConvertedValue(target));

            IArrayFunctionInstance afi = this.tail;

            while (afi is ArrayHeadTailFunctionInstance)
            {
                ArrayHeadTailFunctionInstance ahfi = (ArrayHeadTailFunctionInstance)afi;
                yield return((T)ahfi.term.ConvertedValue(target));

                afi = ahfi.tail;
            }
        }
        public IEnumerator <IFunctionInstance> GetEnumerator()
        {
            yield return(this.term);

            IArrayFunctionInstance afi = this.tail;

            while (afi is ArrayHeadTailFunctionInstance)
            {
                ArrayHeadTailFunctionInstance ahfi = (ArrayHeadTailFunctionInstance)afi;
                yield return(ahfi.term);

                afi = ahfi.tail;
            }
        }
Exemplo n.º 4
0
        public string TermString(IArrayFunctionInstance instance)
        {
            StringBuilder sb = new StringBuilder("[");

            if (this.Equals(instance.Header))
            {
                ArrayHeadTailFunctionInstance ahtfi = (ArrayHeadTailFunctionInstance)instance;
                sb.Append(ahtfi.Term);
                instance = ahtfi.Tail;
            }
            this.generateRestTermString(sb, instance);
            sb.Append("]");
            return(sb.ToString());
        }