Esempio n. 1
0
        private IEnumerable <ExecutionMessage> SDefine(List <SExpression> args, Environment e)
        {
            if (e.hasParent())
            {
                throw new Exception("Define only allowed at global scope");
            }

            SID name             = (SID)args[0];
            ExecutionMessage msg = null;

            foreach (var tmsg in evaluate(args[1], e))
            {
                msg = tmsg;
                if (msg.status == ExecStatus.DONE)
                {
                    break;
                }
                yield return(msg);
            }
            e.addVal(name.identifier, msg.returnVal);

            yield return(new ExecutionMessage(ExecStatus.DONE, new SNone()));
        }