Notes on programing languages

Ruby is the new world, Python is boring.

TODO

Interpreter with Python

program - parse -> abstract-syntax-tree - eval -> result

sspy.py - a tiny scheme interpreter with python - shows the interpreter details.

python3 sspy.py
lis.py> (begin (define r 10) (* pi (* r r)))
314.1592653589793
lis.py>

Python Data Model -> A Framework/API for core language constructs

We can leverage the Python Data Model to build new classes.

By using and implementing special methods of Python Data Model in your objects, your objects can behave like the built-in types, enabling the expressive coding style Pythonic. You will find that your intuition applies everywhere.

Data Sturctures
Functions as objects
target = deco(target)
def deco(func):
    def inner():
        print("running inner()")
    return inner

@deco
def target():
    print("running target()")
    return
Object Oriented
Iteration
def gen_ab():
    yield 'A'
    yield 'B'
Context Managers
generators as coroutines
Metaprogramming

Standard ML

notes

reference