Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

‪Ya, graphic programming.‬

Name: Anonymous 2007-10-05 23:01

There's this scene in Lain where she's programming on a portable device with a stylus, just dragging and pointing and clicking to navigate and stuff.
I want such an programming environment. I want it to death.
So I'm wondering, how would a language for such a purpose look? They used LISP in the series, but while LISP syntax is very simple (good), I'm thinking you'd want a slightly less dynamic language, to allow the environment to do better definition lookup, autocompletion, etc. If you don't have a keyboard, you'll want to avoid typing as much as possible.

So, language suitable for making a kickass drag-and-drop, point-and-click code editor interface. Any existing out there? How would a new one look?

Name: Anonymous 2007-10-07 12:50

Continuing, in case anyone is actually interested, here is some python code as mentioned in >>42

Heres whats being done:

int   [i]a=0[/i] depends on [i]add[/i]
+     [i]add[/i] depends on [i]a, 1[/i]
!=    [i]neq[/i] depends on [i]add, 10[/i]
print [i]prn[/i] depends on [i]a[/i]


Heres the python code:

# Here are the dependencies built up out of Python objects.
f_int_a = func_int()
f_add = func_add(const=[1])
f_neq = func_noteq(const=[10])
f_prn = func_print()

f_int_a.add(f_prn)
f_int_a.add(f_add)
f_add.add(f_neq)
f_neq.add(f_int_a)

# By passing a value to 'a', we fulfill its dependency and start a chain reaction of function evaluation.
f_int_a(0)


The f_* functions are defined as:

def func_int (const=[]):
    def func (inputs):
        return inputs[0]
    return Function("int", func, 1, const)

def func_add (n=2, const=[]):
    def func (inputs):
        return reduce(lambda a, b: a + b, inputs)
    return Function("+", func, n, const)

def func_noteq (const=[]):
    def func (inputs):
        if inputs[0] != inputs[1]:
            return inputs[1]
        else:
            return None
    return Function("!=", func, 2, const)

def func_print ():
    def func (inputs):
        print inputs[0]
        return 1
    return Function("print", func, 1)


Where Function is a class which stores a list of dependencies and evaluates func when all dependencies are met.
It's parameters are: name, function to evaluate, number of dependencies and constants (constants being pre-evaluated dependencies).

Running the code outputs 0 through 9 to the console (one number per line). So far, this isn't exactly useful or anything, but serves as a proof of concept.


If anyone wants the code for Function, let me know and I'll clean it up a bit and post. Otherwise, I won't bother.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List