joethephish's comments

joethephish | 10 years ago | on: Ink: the scripting language behind 80 Days and Sorcery

Hey, Joe here from inkle! Sago's reply is really good, but broadly for those two specific languages: Ink is designed to be one component in a larger game engine - the runtime has a simple core loop of choice -> text generation -> choice. How you implement the UI is up to you (right now we have a C# runtime designed for usage in Unity). By comparison, Inform7 is designed for building standalone parser-based text adventures in the vein of Zork and its more modern successors.

joethephish | 13 years ago | on: μLithp - a Lisp in 27 lines of Ruby

Not sure what this proves exactly. For fun, here's a Javascript equivalent in 27, err, "lines":

    module.exports = function() {
        var atom = function(val) { return val instanceof Array ? false : true; };
        var env = {
            label:  function(sexpr, senv) { senv[sexpr[1]] = evaluate( sexpr[2] ); },
            quote:  function(sexpr, senv) { return sexpr[1]; },
            "==":   function(sexpr, senv) { return evaluate(sexpr[1], senv) == evaluate(sexpr[2], senv); },
            head:   function(sexpr, senv) { return evaluate(sexpr[1], senv)[0]; },
            tail:   function(sexpr, senv) { return evaluate(sexpr[1], senv).slice(1); },
            conc:   function(sexpr, senv) { return [evaluate(sexpr[1])].concat(evaluate(sexpr[2])); },
            "if":   function(sexpr, senv) { return evaluate(sexpr[1], senv) ? evaluate(sexpr[2], senv) : evaluate(sexpr[3], senv); },
            atom:   function(sexpr, senv) { return atom(sexpr[1]); },
            lambda: function(sexpr, senv) {
                return function(lexpr, lenv) {
                    for(var i=0; i<sexpr[1].length; ++i) lenv[sexpr[1][i]] = evaluate(lexpr[i+1], lenv);
                    return evaluate(sexpr[2], lenv);
                };
            }
        };

        var evaluate = function(sexpr, senv) {
            senv = senv || env;
            if( atom(sexpr) ) return senv[sexpr] !== undefined ? senv[sexpr] : sexpr;
            else return senv[sexpr[0]](sexpr, senv);
        };

        this.evaluate = evaluate;
    };
Example:

    var notlisp = require("./notlisp.js"); 
    var l = new notlisp();
    l.evaluate( ["label", "second", ["lambda", ["x"], ["head", ["tail", "x"]]]] );
    l.evaluate( ["second", ["quote", [1, 2, 3]] ] );
page 1