Esempio n. 1
0
        public static void Init(IokeObject bm)
        {
            Runtime runtime = bm.runtime;

            bm.Kind = "Benchmark";
            runtime.Ground.SetCell("Benchmark", bm);
            bm.MimicsWithoutCheck(runtime.Origin);

            bm.RegisterMethod(runtime.NewNativeMethod("expects two optional numbers, x (default 10) and y (default 1), and a block of code to run, and will run benchmark this block x times, while looping y times in each benchmark. after each loop will print the timings for this loop",
                                                      new NativeMethod("report", DefaultArgumentsDefinition.builder()
                                                                       .WithOptionalPositional("repetitions", "10")
                                                                       .WithOptionalPositional("loops", "1")
                                                                       .WithRequiredPositionalUnevaluated("code")
                                                                       .Arguments,
                                                                       (method, context, message, on, outer) => {
                outer.ArgumentsDefinition.CheckArgumentCount(context, message, on);
                int count       = message.Arguments.Count;
                int bmRounds    = 10;
                long iterations = 1;
                int index       = 0;
                if (count > 1)
                {
                    bmRounds = ((Number)IokeObject.dataOf(IokeObject.ConvertToNumber(Interpreter.GetEvaluatedArgument(message, index, context), message, context))).AsNativeInteger();
                    index++;
                    if (count > 2)
                    {
                        iterations = ((Number)IokeObject.dataOf(IokeObject.ConvertToNumber(Interpreter.GetEvaluatedArgument(message, index, context), message, context))).AsNativeLong();
                        index++;
                    }
                }

                for (int i = 0; i < bmRounds; i++)
                {
                    long before = System.DateTime.Now.Ticks;
                    for (int j = 0; j < iterations; j++)
                    {
                        Interpreter.GetEvaluatedArgument(message, index, context);
                    }
                    long after = System.DateTime.Now.Ticks;
                    long time  = after - before;
                    long secs  = time / 10000000;
                    long rest  = time % 10000000;

                    string theCode = Message.ThisCode(((IokeObject)message.Arguments[index]));

                    Interpreter.Send(context.runtime.printlnMessage, context, Interpreter.Send(context.runtime.outMessage, context, context.runtime.System), context.runtime.NewText(string.Format("{0,-32} {1:d6}.{2:d9}", theCode, secs, rest)));
                }

                return(context.runtime.nil);
            })));
        }
Esempio n. 2
0
        public static void Init(IokeObject obj)
        {
            obj.Kind = "DefaultBehavior Case";

            obj.RegisterMethod(obj.runtime.NewNativeMethod("takes one argument that should evaluate to a value, zero or more whenAndThen pairs and one optional else clause. will first evaluate the initial value, then check each whenAndThen pair against this value. if the when part of a pair returns true, then return the result of evaluating the then part. if no pair matches and no else clause is present, returns nil. if an else clause is there, it should be the last one. each whenAndThen pair is comprised of two arguments, where the first is the when argument and the second is the then argument. the when part will be evaluated and the result of this evaluation will be sent a === message with the value as argument.",
                                                           new NativeMethod("case", DefaultArgumentsDefinition.builder()
                                                                            .WithRequiredPositional("value")
                                                                            .WithRestUnevaluated("whensAndThens")
                                                                            .WithOptionalPositionalUnevaluated("elseCode")
                                                                            .Arguments,
                                                                            (method, context, message, on, outer) => {
                outer.ArgumentsDefinition.CheckArgumentCount(context, message, on);
                Runtime runtime = context.runtime;

                var args       = message.Arguments;
                int argCount   = args.Count;
                int index      = 0;
                IokeObject msg = IokeObject.As(args[index++], context);
                object value   = runtime.interpreter.Evaluate(msg, context, context.RealContext, context);
                argCount--;

                while (argCount > 1)
                {
                    msg         = TransformWhenStatement(args[index++], context, message, obj);
                    object when = runtime.interpreter.Evaluate(msg, context, context.RealContext, context);
                    if (IokeObject.IsObjectTrue(Interpreter.Send(runtime.eqqMessage, context, when, value)))
                    {
                        msg = IokeObject.As(args[index++], context);
                        return(runtime.interpreter.Evaluate(msg, context, context.RealContext, context));
                    }
                    else
                    {
                        index++;
                    }
                    argCount -= 2;
                }

                if (argCount == 1)
                {
                    msg = IokeObject.As(args[index++], context);
                    return(runtime.interpreter.Evaluate(msg, context, context.RealContext, context));
                }

                return(runtime.nil);
            })));
        }
Esempio n. 3
0
        public override void Init(IokeObject obj)
        {
            obj.Kind = "Method";
            obj.SetActivatable(true);

            obj.RegisterMethod(obj.runtime.NewNativeMethod("activates this method with the arguments given to call",
                                                           new NativeMethod("call", DefaultArgumentsDefinition.builder()
                                                                            .WithRestUnevaluated("arguments")
                                                                            .Arguments,
                                                                            (method, _context, message, on, outer) => {
                return(Interpreter.Activate(IokeObject.As(on, _context), _context, message, _context.RealContext));
            })));

            obj.RegisterMethod(obj.runtime.NewNativeMethod("returns the name of the method",
                                                           new TypeCheckingNativeMethod.WithNoArguments("name", obj,
                                                                                                        (method, on, args, keywords, _context, message) => {
                return(_context.runtime.NewText(((Method)IokeObject.dataOf(on)).name));
            })));

            obj.RegisterMethod(obj.runtime.NewNativeMethod("Returns a text inspection of the object",
                                                           new TypeCheckingNativeMethod.WithNoArguments("inspect", obj,
                                                                                                        (method, on, args, keywords, _context, message) => {
                return(_context.runtime.NewText(Method.GetInspect(on)));
            })));

            obj.RegisterMethod(obj.runtime.NewNativeMethod("Returns a brief text inspection of the object",
                                                           new TypeCheckingNativeMethod.WithNoArguments("notice", obj,
                                                                                                        (method, on, args, keywords, _context, message) => {
                return(_context.runtime.NewText(Method.GetNotice(on)));
            })));

            obj.RegisterMethod(obj.runtime.NewNativeMethod("returns the full code of this method, as a Text",
                                                           new TypeCheckingNativeMethod.WithNoArguments("code", obj,
                                                                                                        (method, on, args, keywords, _context, message) => {
                IokeData data = IokeObject.dataOf(on);
                if (data is Method)
                {
                    return(_context.runtime.NewText(((Method)data).CodeString));
                }
                else
                {
                    return(_context.runtime.NewText(((AliasMethod)data).CodeString));
                }
            })));
        }
Esempio n. 4
0
        public static void Init(IokeObject rl)
        {
            Runtime runtime = rl.runtime;

            rl.Kind = "Readline";
            rl.MimicsWithoutCheck(runtime.Origin);
            runtime.Ground.SetCell("Readline", rl);
            rl.SetCell("VERSION", runtime.NewText("Mono.Terminal.LineEditor wrapper"));

            ConsoleHolder holder = new ConsoleHolder();

            holder.history = new History("ioke", 10);

            IokeObject history = runtime.NewFromOrigin();

            rl.SetCell("HISTORY", history);

            rl.RegisterMethod(runtime.NewNativeMethod("will print a prompt to standard out and then try to read a line with working readline functionality. takes two arguments, the first is the string to prompt, the second is a boolean that says whether we should add the read string to history or not",
                                                      new NativeMethod("readline", DefaultArgumentsDefinition.builder()
                                                                       .WithRequiredPositional("prompt")
                                                                       .WithRequiredPositional("addToHistory?")
                                                                       .Arguments,
                                                                       (method, context, message, on, outer) => {
                var args = new SaneArrayList();
                outer.ArgumentsDefinition.GetEvaluatedArguments(context, message, on, args, new SaneDictionary <string, object>());
                object line = method.runtime.nil;
                try {
                    if (holder.readline == null)
                    {
                        InitReadline(method.runtime, holder);
                    }
                    string v = holder.readline.Edit(Text.GetText(args[0]), "");
                    if (null != v)
                    {
                        if (IokeObject.IsObjectTrue(args[1]))
                        {
                            holder.history.Append(v);
                        }

                        line = method.runtime.NewText(v);
                    }
                } catch (IOException e) {
                    IokeObject condition = IokeObject.As(IokeObject.GetCellChain(runtime.Condition,
                                                                                 message,
                                                                                 context,
                                                                                 "Error",
                                                                                 "IO"), context).Mimic(message, context);
                    condition.SetCell("message", message);
                    condition.SetCell("context", context);
                    condition.SetCell("receiver", on);
                    condition.SetCell("exceptionMessage", runtime.NewText(e.Message));
                    var st = new System.Diagnostics.StackTrace(e);
                    var ob = new SaneArrayList();
                    foreach (var frame in st.GetFrames())
                    {
                        ob.Add(runtime.NewText(frame.ToString()));
                    }
                    condition.SetCell("exceptionStackTrace", runtime.NewList(ob));

                    runtime.WithReturningRestart("ignore", context, () => { runtime.ErrorCondition(condition); });
                }
                return(line);
            })));

            history.RegisterMethod(runtime.NewNativeMethod("will add a new line to the history",
                                                           new NativeMethod("<<", DefaultArgumentsDefinition.builder()
                                                                            .WithRequiredPositional("line")
                                                                            .Arguments,
                                                                            (method, context, message, on, outer) => {
                var args = new SaneArrayList();
                outer.ArgumentsDefinition.GetEvaluatedArguments(context, message, on, args, new SaneDictionary <string, object>());
                foreach (object o in args)
                {
                    holder.history.Append(Text.GetText(o));
                }
                return(context.runtime.nil);
            })));
        }
Esempio n. 5
0
        public static void Init(IokeObject obj)
        {
            Runtime runtime = obj.runtime;

            obj.Kind = "DefaultBehavior Assignment";

            obj.RegisterMethod(runtime.NewNativeMethod("expects one argument, which is the unevaluated name of the cell to work on. will retrieve the current value of this cell, call 'succ' to that value and then send = to the current receiver with the name and the resulting value.",
                                                       new NativeMethod("++", DefaultArgumentsDefinition.builder()
                                                                        .WithRequiredPositionalUnevaluated("place")
                                                                        .Arguments,
                                                                        (method, context, message, on, outer) => {
                outer.ArgumentsDefinition.CheckArgumentCount(context, message, on);
                IokeObject nameMessage = (IokeObject)(Message.GetArguments(message)[0]);
                string name            = nameMessage.Name;
                object current         = Interpreter.Perform(on, IokeObject.As(on, context), context, message, name);
                object value           = Interpreter.Send(runtime.succMessage, context, current);
                return(Interpreter.Send(runtime.setValueMessage, context, on, nameMessage, value));
            })));

            obj.RegisterMethod(runtime.NewNativeMethod("expects one argument, which is the unevaluated name of the cell to work on. will retrieve the current value of this cell, call 'pred' to that value and then send = to the current receiver with the name and the resulting value.",
                                                       new NativeMethod("--", DefaultArgumentsDefinition.builder()
                                                                        .WithRequiredPositionalUnevaluated("place")
                                                                        .Arguments,
                                                                        (method, context, message, on, outer) => {
                outer.ArgumentsDefinition.CheckArgumentCount(context, message, on);
                IokeObject nameMessage = (IokeObject)(Message.GetArguments(message)[0]);
                string name            = nameMessage.Name;
                object current         = Interpreter.Perform(on, IokeObject.As(on, context), context, message, name);
                object value           = Interpreter.Send(runtime.predMessage, context, current);
                return(Interpreter.Send(runtime.setValueMessage, context, on, nameMessage, value));
            })));

            obj.RegisterMethod(runtime.NewNativeMethod("expects two arguments, the first unevaluated, the second evaluated. the first argument should be the name of a cell. if that cell doesn't exist or the value it contains is not true, that cell will be set to the second argument, otherwise nothing will happen. the second argument will NOT be evaluated if the place is not assigned. the result of the expression is the value of the cell. it will use = for this assignment. this method also work together with forms such as []=.",
                                                       new NativeMethod("||=", DefaultArgumentsDefinition.builder()
                                                                        .WithRequiredPositionalUnevaluated("place")
                                                                        .WithRequiredPositional("else")
                                                                        .Arguments,
                                                                        (method, context, message, on, outer) => {
                outer.ArgumentsDefinition.CheckArgumentCount(context, message, on);

                IokeObject m1 = IokeObject.As(Message.GetArguments(message)[0], context);
                string name   = m1.Name;

                if (m1.Arguments.Count == 0)
                {
                    object val = IokeObject.FindCell(((IokeObject)on), name);
                    if (val == context.runtime.nul || !IokeObject.IsObjectTrue(val))
                    {
                        return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, Message.GetArguments(message)[1]));
                    }
                    else
                    {
                        return(val);
                    }
                }
                else
                {
                    object val = Interpreter.Send(m1, context, on);
                    if (val == context.runtime.nul || !IokeObject.IsObjectTrue(val))
                    {
                        return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, Message.GetArguments(message)[1]));
                    }
                    else
                    {
                        return(val);
                    }
                }
            })));

            obj.RegisterMethod(runtime.NewNativeMethod("expects two arguments, the first unevaluated, the second evaluated. the first argument should be the name of a cell. if that cell exist and the value it contains is a true one, that cell will be set to the second argument, otherwise nothing will happen. the second argument will NOT be evaluated if the place is not assigned. the result of the expression is the value of the cell. it will use = for this assignment. this method also work together with forms such as []=.",
                                                       new NativeMethod("&&=", DefaultArgumentsDefinition.builder()
                                                                        .WithRequiredPositionalUnevaluated("place")
                                                                        .WithRequiredPositional("then")
                                                                        .Arguments,
                                                                        (method, context, message, on, outer) => {
                outer.ArgumentsDefinition.CheckArgumentCount(context, message, on);

                IokeObject m1 = IokeObject.As(Message.GetArguments(message)[0], context);
                string name   = m1.Name;

                if (m1.Arguments.Count == 0)
                {
                    object val = IokeObject.FindCell(((IokeObject)on), name);
                    if (val == context.runtime.nul || !IokeObject.IsObjectTrue(val))
                    {
                        return(context.runtime.nil);
                    }
                    else
                    {
                        return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, Message.GetArguments(message)[1]));
                    }
                }
                else
                {
                    object val = Interpreter.Send(m1, context, on);
                    if (val == context.runtime.nul || !IokeObject.IsObjectTrue(val))
                    {
                        return(context.runtime.nil);
                    }
                    else
                    {
                        return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, Message.GetArguments(message)[1]));
                    }
                }
            })));

            obj.RegisterMethod(runtime.NewNativeMethod("expects two arguments, the first unevaluated, the second evaluated. the first argument should be the name of a cell. the value of that cell will be retreived and then the + method will be called on it. finally, the result of the call to + will be assigned to the same name in the current scope. it will use = for this assignment. the result of the expression is the same as the result of the assignment. this method also work together with forms such as []=.",
                                                       new NativeMethod("+=", DefaultArgumentsDefinition.builder()
                                                                        .WithRequiredPositionalUnevaluated("place")
                                                                        .WithRequiredPositional("addend")
                                                                        .Arguments,
                                                                        (method, context, message, on, outer) => {
                outer.ArgumentsDefinition.CheckArgumentCount(context, message, on);

                IokeObject m1 = IokeObject.As(Message.GetArguments(message)[0], context);
                string name   = m1.Name;

                if (m1.Arguments.Count == 0)
                {
                    object val    = IokeObject.GetCell(on, message, context, name);
                    object result = Interpreter.Send(context.runtime.plusMessage, context, val, Message.GetArguments(message)[1]);
                    return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, context.runtime.CreateMessage(Message.Wrap(IokeObject.As(result, context)))));
                }
                else
                {
                    object val    = Interpreter.Send(m1, context, on);
                    object result = Interpreter.Send(context.runtime.plusMessage, context, val, Message.GetArguments(message)[1]);
                    return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, context.runtime.CreateMessage(Message.Wrap(IokeObject.As(result, context)))));
                }
            })));

            obj.RegisterMethod(runtime.NewNativeMethod("expects two arguments, the first unevaluated, the second evaluated. the first argument should be the name of a cell. the value of that cell will be retreived and then the - method will be called on it. finally, the result of the call to - will be assigned to the same name in the current scope. it will use = for this assignment. the result of the expression is the same as the result of the assignment. this method also work together with forms such as []=.",
                                                       new NativeMethod("-=", DefaultArgumentsDefinition.builder()
                                                                        .WithRequiredPositionalUnevaluated("place")
                                                                        .WithRequiredPositional("subtrahend")
                                                                        .Arguments,
                                                                        (method, context, message, on, outer) => {
                outer.ArgumentsDefinition.CheckArgumentCount(context, message, on);

                IokeObject m1 = IokeObject.As(Message.GetArguments(message)[0], context);
                string name   = m1.Name;

                if (m1.Arguments.Count == 0)
                {
                    object val    = IokeObject.GetCell(on, message, context, name);
                    object result = Interpreter.Send(context.runtime.minusMessage, context, val, Message.GetArguments(message)[1]);
                    return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, context.runtime.CreateMessage(Message.Wrap(IokeObject.As(result, context)))));
                }
                else
                {
                    object val    = Interpreter.Send(m1, context, on);
                    object result = Interpreter.Send(context.runtime.minusMessage, context, val, Message.GetArguments(message)[1]);
                    return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, context.runtime.CreateMessage(Message.Wrap(IokeObject.As(result, context)))));
                }
            })));

            obj.RegisterMethod(runtime.NewNativeMethod("expects two arguments, the first unevaluated, the second evaluated. the first argument should be the name of a cell. the value of that cell will be retreived and then the * method will be called on it. finally, the result of the call to * will be assigned to the same name in the current scope. it will use = for this assignment. the result of the expression is the same as the result of the assignment. this method also work together with forms such as []=.",
                                                       new NativeMethod("*=", DefaultArgumentsDefinition.builder()
                                                                        .WithRequiredPositionalUnevaluated("place")
                                                                        .WithRequiredPositional("multiplier")
                                                                        .Arguments,
                                                                        (method, context, message, on, outer) => {
                outer.ArgumentsDefinition.CheckArgumentCount(context, message, on);

                IokeObject m1 = IokeObject.As(Message.GetArguments(message)[0], context);
                string name   = m1.Name;

                if (m1.Arguments.Count == 0)
                {
                    object val    = IokeObject.GetCell(on, message, context, name);
                    object result = Interpreter.Send(context.runtime.multMessage, context, val, Message.GetArguments(message)[1]);
                    return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, context.runtime.CreateMessage(Message.Wrap(IokeObject.As(result, context)))));
                }
                else
                {
                    object val    = Interpreter.Send(m1, context, on);
                    object result = Interpreter.Send(context.runtime.multMessage, context, val, Message.GetArguments(message)[1]);
                    return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, context.runtime.CreateMessage(Message.Wrap(IokeObject.As(result, context)))));
                }
            })));

            obj.RegisterMethod(runtime.NewNativeMethod("expects two arguments, the first unevaluated, the second evaluated. the first argument should be the name of a cell. the value of that cell will be retreived and then the / method will be called on it. finally, the result of the call to / will be assigned to the same name in the current scope. it will use = for this assignment. the result of the expression is the same as the result of the assignment. this method also work together with forms such as []=.",
                                                       new NativeMethod("/=", DefaultArgumentsDefinition.builder()
                                                                        .WithRequiredPositionalUnevaluated("place")
                                                                        .WithRequiredPositional("divisor")
                                                                        .Arguments,
                                                                        (method, context, message, on, outer) => {
                outer.ArgumentsDefinition.CheckArgumentCount(context, message, on);

                IokeObject m1 = IokeObject.As(Message.GetArguments(message)[0], context);
                string name   = m1.Name;

                if (m1.Arguments.Count == 0)
                {
                    object val    = IokeObject.GetCell(on, message, context, name);
                    object result = Interpreter.Send(context.runtime.divMessage, context, val, Message.GetArguments(message)[1]);
                    return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, context.runtime.CreateMessage(Message.Wrap(IokeObject.As(result, context)))));
                }
                else
                {
                    object val    = Interpreter.Send(m1, context, on);
                    object result = Interpreter.Send(context.runtime.divMessage, context, val, Message.GetArguments(message)[1]);
                    return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, context.runtime.CreateMessage(Message.Wrap(IokeObject.As(result, context)))));
                }
            })));

            obj.RegisterMethod(runtime.NewNativeMethod("expects two arguments, the first unevaluated, the second evaluated. the first argument should be the name of a cell. the value of that cell will be retreived and then the % method will be called on it. finally, the result of the call to % will be assigned to the same name in the current scope. it will use = for this assignment. the result of the expression is the same as the result of the assignment. this method also work together with forms such as []=.",
                                                       new NativeMethod("%=", DefaultArgumentsDefinition.builder()
                                                                        .WithRequiredPositionalUnevaluated("place")
                                                                        .WithRequiredPositional("divisor")
                                                                        .Arguments,
                                                                        (method, context, message, on, outer) => {
                outer.ArgumentsDefinition.CheckArgumentCount(context, message, on);

                IokeObject m1 = IokeObject.As(Message.GetArguments(message)[0], context);
                string name   = m1.Name;

                if (m1.Arguments.Count == 0)
                {
                    object val    = IokeObject.GetCell(on, message, context, name);
                    object result = Interpreter.Send(context.runtime.modMessage, context, val, Message.GetArguments(message)[1]);
                    return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, context.runtime.CreateMessage(Message.Wrap(IokeObject.As(result, context)))));
                }
                else
                {
                    object val    = Interpreter.Send(m1, context, on);
                    object result = Interpreter.Send(context.runtime.modMessage, context, val, Message.GetArguments(message)[1]);
                    return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, context.runtime.CreateMessage(Message.Wrap(IokeObject.As(result, context)))));
                }
            })));

            obj.RegisterMethod(runtime.NewNativeMethod("expects two arguments, the first unevaluated, the second evaluated. the first argument should be the name of a cell. the value of that cell will be retreived and then the ** method will be called on it. finally, the result of the call to ** will be assigned to the same name in the current scope. it will use = for this assignment. the result of the expression is the same as the result of the assignment. this method also work together with forms such as []=.",
                                                       new NativeMethod("**=", DefaultArgumentsDefinition.builder()
                                                                        .WithRequiredPositionalUnevaluated("place")
                                                                        .WithRequiredPositional("exponent")
                                                                        .Arguments,
                                                                        (method, context, message, on, outer) => {
                outer.ArgumentsDefinition.CheckArgumentCount(context, message, on);

                IokeObject m1 = IokeObject.As(Message.GetArguments(message)[0], context);
                string name   = m1.Name;

                if (m1.Arguments.Count == 0)
                {
                    object val    = IokeObject.GetCell(on, message, context, name);
                    object result = Interpreter.Send(context.runtime.expMessage, context, val, Message.GetArguments(message)[1]);
                    return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, context.runtime.CreateMessage(Message.Wrap(IokeObject.As(result, context)))));
                }
                else
                {
                    object val    = Interpreter.Send(m1, context, on);
                    object result = Interpreter.Send(context.runtime.expMessage, context, val, Message.GetArguments(message)[1]);
                    return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, context.runtime.CreateMessage(Message.Wrap(IokeObject.As(result, context)))));
                }
            })));

            obj.RegisterMethod(runtime.NewNativeMethod("expects two arguments, the first unevaluated, the second evaluated. the first argument should be the name of a cell. the value of that cell will be retreived and then the & method will be called on it. finally, the result of the call to & will be assigned to the same name in the current scope. it will use = for this assignment. the result of the expression is the same as the result of the assignment. this method also work together with forms such as []=.",
                                                       new NativeMethod("&=", DefaultArgumentsDefinition.builder()
                                                                        .WithRequiredPositionalUnevaluated("place")
                                                                        .WithRequiredPositional("other")
                                                                        .Arguments,
                                                                        (method, context, message, on, outer) => {
                outer.ArgumentsDefinition.CheckArgumentCount(context, message, on);

                IokeObject m1 = IokeObject.As(Message.GetArguments(message)[0], context);
                string name   = m1.Name;

                if (m1.Arguments.Count == 0)
                {
                    object val    = IokeObject.GetCell(on, message, context, name);
                    object result = Interpreter.Send(context.runtime.binAndMessage, context, val, Message.GetArguments(message)[1]);
                    return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, context.runtime.CreateMessage(Message.Wrap(IokeObject.As(result, context)))));
                }
                else
                {
                    object val    = Interpreter.Send(m1, context, on);
                    object result = Interpreter.Send(context.runtime.binAndMessage, context, val, Message.GetArguments(message)[1]);
                    return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, context.runtime.CreateMessage(Message.Wrap(IokeObject.As(result, context)))));
                }
            })));

            obj.RegisterMethod(runtime.NewNativeMethod("expects two arguments, the first unevaluated, the second evaluated. the first argument should be the name of a cell. the value of that cell will be retreived and then the | method will be called on it. finally, the result of the call to | will be assigned to the same name in the current scope. it will use = for this assignment. the result of the expression is the same as the result of the assignment. this method also work together with forms such as []=.",
                                                       new NativeMethod("|=", DefaultArgumentsDefinition.builder()
                                                                        .WithRequiredPositionalUnevaluated("place")
                                                                        .WithRequiredPositional("other")
                                                                        .Arguments,
                                                                        (method, context, message, on, outer) => {
                outer.ArgumentsDefinition.CheckArgumentCount(context, message, on);

                IokeObject m1 = IokeObject.As(Message.GetArguments(message)[0], context);
                string name   = m1.Name;

                if (m1.Arguments.Count == 0)
                {
                    object val    = IokeObject.GetCell(on, message, context, name);
                    object result = Interpreter.Send(context.runtime.binOrMessage, context, val, Message.GetArguments(message)[1]);
                    return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, context.runtime.CreateMessage(Message.Wrap(IokeObject.As(result, context)))));
                }
                else
                {
                    object val    = Interpreter.Send(m1, context, on);
                    object result = Interpreter.Send(context.runtime.binOrMessage, context, val, Message.GetArguments(message)[1]);
                    return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, context.runtime.CreateMessage(Message.Wrap(IokeObject.As(result, context)))));
                }
            })));

            obj.RegisterMethod(runtime.NewNativeMethod("expects two arguments, the first unevaluated, the second evaluated. the first argument should be the name of a cell. the value of that cell will be retreived and then the ^ method will be called on it. finally, the result of the call to ^ will be assigned to the same name in the current scope. it will use = for this assignment. the result of the expression is the same as the result of the assignment. this method also work together with forms such as []=.",
                                                       new NativeMethod("^=", DefaultArgumentsDefinition.builder()
                                                                        .WithRequiredPositionalUnevaluated("place")
                                                                        .WithRequiredPositional("other")
                                                                        .Arguments,
                                                                        (method, context, message, on, outer) => {
                outer.ArgumentsDefinition.CheckArgumentCount(context, message, on);

                IokeObject m1 = IokeObject.As(Message.GetArguments(message)[0], context);
                string name   = m1.Name;

                if (m1.Arguments.Count == 0)
                {
                    object val    = IokeObject.GetCell(on, message, context, name);
                    object result = Interpreter.Send(context.runtime.binXorMessage, context, val, Message.GetArguments(message)[1]);
                    return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, context.runtime.CreateMessage(Message.Wrap(IokeObject.As(result, context)))));
                }
                else
                {
                    object val    = Interpreter.Send(m1, context, on);
                    object result = Interpreter.Send(context.runtime.binXorMessage, context, val, Message.GetArguments(message)[1]);
                    return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, context.runtime.CreateMessage(Message.Wrap(IokeObject.As(result, context)))));
                }
            })));

            obj.RegisterMethod(runtime.NewNativeMethod("expects two arguments, the first unevaluated, the second evaluated. the first argument should be the name of a cell. the value of that cell will be retreived and then the << method will be called on it. finally, the result of the call to << will be assigned to the same name in the current scope. it will use = for this assignment. the result of the expression is the same as the result of the assignment. this method also work together with forms such as []=.",
                                                       new NativeMethod("<<=", DefaultArgumentsDefinition.builder()
                                                                        .WithRequiredPositionalUnevaluated("place")
                                                                        .WithRequiredPositional("other")
                                                                        .Arguments,
                                                                        (method, context, message, on, outer) => {
                outer.ArgumentsDefinition.CheckArgumentCount(context, message, on);

                IokeObject m1 = IokeObject.As(Message.GetArguments(message)[0], context);
                string name   = m1.Name;

                if (m1.Arguments.Count == 0)
                {
                    object val    = IokeObject.GetCell(on, message, context, name);
                    object result = Interpreter.Send(context.runtime.lshMessage, context, val, Message.GetArguments(message)[1]);
                    return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, context.runtime.CreateMessage(Message.Wrap(IokeObject.As(result, context)))));
                }
                else
                {
                    object val    = Interpreter.Send(m1, context, on);
                    object result = Interpreter.Send(context.runtime.lshMessage, context, val, Message.GetArguments(message)[1]);
                    return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, context.runtime.CreateMessage(Message.Wrap(IokeObject.As(result, context)))));
                }
            })));

            obj.RegisterMethod(runtime.NewNativeMethod("expects two arguments, the first unevaluated, the second evaluated. the first argument should be the name of a cell. the value of that cell will be retreived and then the >> method will be called on it. finally, the result of the call to >> will be assigned to the same name in the current scope. it will use = for this assignment. the result of the expression is the same as the result of the assignment. this method also work together with forms such as []=.",
                                                       new NativeMethod(">>=", DefaultArgumentsDefinition.builder()
                                                                        .WithRequiredPositionalUnevaluated("place")
                                                                        .WithRequiredPositional("other")
                                                                        .Arguments,
                                                                        (method, context, message, on, outer) => {
                outer.ArgumentsDefinition.CheckArgumentCount(context, message, on);

                IokeObject m1 = IokeObject.As(Message.GetArguments(message)[0], context);
                string name   = m1.Name;

                if (m1.Arguments.Count == 0)
                {
                    object val    = IokeObject.GetCell(on, message, context, name);
                    object result = Interpreter.Send(context.runtime.rshMessage, context, val, Message.GetArguments(message)[1]);
                    return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, context.runtime.CreateMessage(Message.Wrap(IokeObject.As(result, context)))));
                }
                else
                {
                    object val    = Interpreter.Send(m1, context, on);
                    object result = Interpreter.Send(context.runtime.rshMessage, context, val, Message.GetArguments(message)[1]);
                    return(Interpreter.Send(context.runtime.setValueMessage, context, on, m1, context.runtime.CreateMessage(Message.Wrap(IokeObject.As(result, context)))));
                }
            })));
        }