Ejemplo n.º 1
0
        public override object Do(KObject args, KEnvironment env, Continuation <KObject> cont)
        {
            CPara(args, 1);
            KEncapsulation datum = First(args) as KEncapsulation;

            Check(datum, "not an encap");
            if (datum.Id != id)
            {
                throw new RuntimeException("wrong id");
            }
            return(datum.Value);
        }
Ejemplo n.º 2
0
        public override RecursionResult <KObject> Combine(KObject args, KEnvironment env, Continuation <KObject> cont)
        {
            var res = CheckParameter(args, 1, "decapsle");

            if (res != null)
            {
                return(CPS.Error(res, cont));
            }
            KObject datum = First(args);

            if (!(datum is KEncapsulation))
            {
                return(CPS.Error("decaplse: not an encap", cont));
            }
            KEncapsulation enc = datum as KEncapsulation;

            if (enc.Id != id)
            {
                return(CPS.Error("decaplse: wrong", cont));
            }
            return(Return(enc.Value, cont));
        }