Linear systems
It seems that evolution process discovered these stable intermediate forms, which has been successfully generalized and abstracted out by multi-discipline institutions, like MIT, which are famous for using insights from Molecular Biology. Alan Kay also successfully translated insights from biology into computer systems.
Abstraction barriers (atoms is an ultimate abstraction barrier)
Cell-membrane (lambda, module, interface)
Nesting (function composition)
Recursion (spiral-shaped processes with a termination condition)
Layered systems (cells, tissues, organs, subsystems)
Linear sequences (proteins)
Tree-line structures (neurons)
Lookup tables (RNA translation)
Encapsulated state (closures)
Signals (synapses)
Message passing (inter-cellular communication)
The Golden Age.
There is no wonder that Scheme has been born in MIT as a synthesis of The Lambda Calculus and Molecular Biology.
It was remarkable, historic achievement when Scheme’s Environment Model has been implemented in Scheme using just a few special forms and lists, trees and a lookup table (made out of lists).
This is a true biological system - it reuses simple, universal, stable intermediate forms as basic building blocks. In the case of Scheme it was lambdas and lists (where lambdas and actual closures were made out of lists).
The actual evaluator (a defining interpreter) has been literally a few pages long and could be understood in its entirety by an ordinary person. The standard library was another few pages.
Think of lists as proteins of programming. LISP and MIT guys did.
All you need is /lambda. Lambdas were enzymes of programming. They has been made out of proteins (lists), of course.
This is how to program and this Golden Age has been lost forever. SML/NJ, Miranda, MIT Scheme and Erlang are the last standing monuments of unsurpassable glory.
Complexity
Complex systems do not work. Layered (nested) simplest (but just right) systems do. It is not jsut my opinion. It is what the process of biological evolution has been discovered.
Standard Libraries
This is not an arbitrary coincidence that every Functional Language, beginning from ISWIM, rely heavily on a list structure, even using special syntax (syntactic sugar) for lists. This reflects how fundamental and universal they are. Other universal data structures, such as trees and tables has been made originally out of lists.
The main principle is composition (of functions or monads), and it is natural in pure functional languages or subsets.
Just remember that composition is nesting under the hood. It is that fundamental.
We nest types and while a function is a value of a primitive type A -> B
, a Monad is an ADT (Abstract Data Type) and has at least 2
functions (with different signatures) in its interface. So in the case of a Monad we compose (and actually nest) ADTs.
Again, a Monad is just an ADT with additional “laws” of a Monoid, whose values can be composed (technically it has to form a Monoid with respect to its functions, which, in turn, form an abstraction barrier, as a standard interface), similar to composition of functions (which are values too). An ADT which must form a Monoid. Nothing to see here.
- SML
- R5RS
- Common Lisp
- Haskell
- Ocaml
Runtimes
One has to reuse these enormous efforts (both in terms of research and man-hours) while restricting oneself to most general, universal basic building blocks.
No, you don’t need that async crap. Lists and Lambdas will do. Plus pure functional subset of the standard library and modules (abstraction barriers and interfaces).
You probably want streams and some sort of reactive triggers, like an observable. Just remember that it should be as simple as a lambda and a condition on which it would be called (and it must be a closure itself).
Unnecessary, redundant abstractions is the root of all evil. Especially in a crappy imperative, untyped languages, to which javascript is an negative optimum. (well, PHP is still the absolute worst, and Java is a monument to human stupidity).
- SML/NJ
- MIT Scheme
- Miranda
- Erlang
- Ocaml
- Haskell
- JVM (with Scala 3)
- .NET (with F#)
- libc++
Just program with lists and lambdas
Proteins and enzymes are good enough to “implement” whole Tree of Life.
It seems that lambdas, types and some syntactic sugar is enough for everything.
It is crucially important to restrict oneself, at least in modeling and executable formal specifications to these fundamental basic building blocks, just like mathematicians use the DSL of The Set Theory and formal Logic.
If you are able to formally specify (formally model) your domain in a pure functional subset of a language which uses no fancy shit, you will benefit enormously, because you would literally stand on the shouters of giants and your writing would be eternally understable, just like core mathematics itself.
Discrete, Linear, Time invariant.
This is a whole class of systems we more or less well-understood.
Finite State Machines, Digital Signal Processing, Linear and Temporal logics, and TLA+ which is based upon these are where to look for knowledge and insight.