Exemple #1
0
        IEnumerator IEnumerable.GetEnumerator()
        {
            var reducer = (IApply)Runtime.Funcall(Transform, new QueueReducer());
            var queue   = (Queue)Runtime.Funcall(reducer);

            foreach (var item in Runtime.ToIter(Seq))
            {
                var result = UseApply ? Runtime.ApplyStar(reducer, queue, item) : Runtime.Funcall(reducer, queue, item);
                if (Runtime.Reducedp(result))
                {
                    break;
                }
                else
                {
                    while (queue.Count > 0)
                    {
                        yield return(queue.Dequeue());
                    }
                }
            }
            Runtime.Funcall(reducer, queue);
            while (queue.Count > 0)
            {
                yield return(queue.Dequeue());
            }
        }
Exemple #2
0
        protected override void OnFormClosed(FormClosedEventArgs e)
        {
            if (OnCloseFunction != null)
            {
                Runtime.Funcall(OnCloseFunction, Content.Window);
            }

            base.OnFormClosed(e);
        }
        void CmdHelp()
        {
            var topic  = ExtractTerm(this.GetStringFromBuffer(HomePos, Pos));
            var helper = Symbols.HelpHook.Value as IApply;

            if (topic != "" && helper != null)
            {
                Runtime.Funcall(helper, Runtime.MakeSymbol(topic));
                Terminal.TerminalWindow.ClearKeyboardBuffer();
            }
        }
Exemple #4
0
        void CmdHelp()
        {
            var line   = lineBuffer.ToString();
            var loc    = Runtime.LocateLeftWord(line, lineIndex);
            var topic  = line.Substring(loc.Begin, loc.Span);
            var helper = Symbols.HelpHook.Value as IApply;

            if (helper != null)
            {
                var sym = topic == "" ? null : Runtime.MakeSymbol(topic);
                Runtime.Funcall(helper, sym);
            }
        }
Exemple #5
0
        object IApply.Apply(object[] args)
        {
            var arg = args[0];

            if (arg is LambdaClosure)
            {
                return(Runtime.Funcall((IApply)arg, this));
            }
            else
            {
                return(this[arg]);
            }
        }
Exemple #6
0
        public Cons AsList()
        {
            var reducer = (IApply)Runtime.Funcall(Transform, new ListReducer());
            var result  = Runtime.Funcall(reducer);

            foreach (var item in Runtime.ToIter(Seq))
            {
                result = (UseApply ? Runtime.ApplyStar(reducer, result, item) : Runtime.Funcall(reducer, result, item));
                if (Runtime.Reducedp(result))
                {
                    break;
                }
            }
            return(((Cons)Runtime.Unreduced(result)).Cdr);
        }
Exemple #7
0
        public Vector AsVector()
        {
            var reducer = (IApply)Runtime.Funcall(Transform, new VectorReducer());
            var result  = Runtime.Funcall(reducer);

            foreach (var item in Runtime.ToIter(Seq))
            {
                result = (UseApply ? Runtime.ApplyStar(reducer, result, item) : Runtime.Funcall(reducer, result, item));
                if (Runtime.Reducedp(result))
                {
                    break;
                }
            }
            return((Vector)Runtime.Unreduced(result));
        }
 public IEnumerable <object> Obj_Int_Enum(object item1, int item2)
 {
     return((IEnumerable <object>)Runtime.Funcall(function, item1, item2));
 }
 public int Obj_Obj_Int(object item1, object item2)
 {
     return((int)Runtime.Funcall(function, item1, item2));
 }
 public void Obj_Void(object item)
 {
     Runtime.Funcall(function, item);
 }
 public bool Obj_Obj_Bool(object item1, object item2)
 {
     return(Runtime.ToBool(Runtime.Funcall(function, item1, item2)));
 }
 public object Obj_Obj(object item)
 {
     return(Runtime.Funcall(function, item));
 }
 public object Obj_Int_Obj(object item1, int item2)
 {
     return(Runtime.Funcall(function, item1, item2));
 }
 public void Obj_Evt_Void(object target, EventArgs evt)
 {
     Runtime.Funcall(function, target, evt);
 }
 public object Obj()
 {
     return(Runtime.Funcall(function));
 }
 public new bool Equals(object x, object y)
 {
     return(Runtime.ToBool(Runtime.Funcall(function, x, y)));
 }
 public int Compare(object item1, object item2)
 {
     return(Runtime.ToInt(Runtime.Funcall(function, item1, item2)));
 }
 public void Void()
 {
     Runtime.Funcall(function);
 }