Jolie Rouge

all ur parentheses Я belong to me

Roblox – Lua Module Design

  1. Design your plugins/modules around Inputs and Outputs
  2. The functions receiving Inputs (and returning Outputs) are your Interface
  3. Obey the Separation of Concerns
  4. Use Dependency Injection of other modules with well defined Interfaces
  5. Never do more than you have to
  6. Never settle for 1 plugin when 2 will be cleaner

Dr. Strangelisp, or How I learned to stop worrying and love the parentheses

The issue with Common Lisp for imperative language programmers is that Lisp has no structure around which to orient oneself. Here I mean structure in the sense of an imperative programming language. There are a lot of symbols in imperative languages that are used to orient you, like guide rails. To an imperative programmer, Lisp leaves them awash in a sea of parentheses, they don’t see the structure that is in fact there.

(defun hello-world () 
    (print "Hello World"))

Lua and “purely” functional object orientation

So here’s a fun little snippet of lua that is functional but also object oriented (the function maintains state).

function CreateInstance()
    local self = {}
    return function(msg)
        if msg == "setMessage" then

Implementing cons, car, and cdr in Lua.

Lua is by far the best scripting language I’ve ever had the pleasure of using. It’s joy to embed, it’s fun to use, and here’s the kicker: It’s more like Lisp/Scheme than you think. I recently saw an absolutely crazy implementation of linked lists, far crazier than the standard Lua implementation. Basically, implementing cons, car, and cdr gets us the linked list for free. The table based implementation may be faster. Note that this idea comes right out of the MIT Scheme lectures, and I believe it’s also in SICP.

function cons(a,b)
    return function (p)
        if p == 1 then
            return a

Understanding Common LISP

LISP is the perfect programming language. It is so perfect, it is shit. Well, okay it is not shit, it’s awesome, but when you first try to learn it, it is completely shit. It is the most obscure, abstract, whacked out language ever thought up. But it’s perfect. It is so elegant, and so simple, that  you just can’t believe it works that way. What makes LISP difficult to learn is that you spend half your time unlearning deeply ingrained prejudices about how things can or should be done.

Getting over this initial hump is the hardest thing about learning LISP. Oh, and the documentation can sometimes really suck. If LISP had PHP style documentation, it would totally rule. It would rule everything.