ivan.moony
Bronze Coder
implementing lambda calculus
Anyone knows good resources on how to efficiently implement untyped lambda calculus?
I mean, it's pretty clear how to do it somehow to an average programmer, but since it's an old paradigm used in existing functional languages for fifty years, are there pitfalls to avoid, or hints to follow on efficient implementation?
base idea
Do you ever feel CSS + HTML + Javascript is a bit cumbersome relict that only got bloated with specific fixes over last thirty or so years? I'm currently working on a neat replacement for those, based only on lambda calculus. Functions are cornerstone of lambda calculus. Function application is a broadly unrecognized powerful formation with a property that all the laying out of HTML elements could entirely be replaced by functions. And since functions may be used for result computation, along simply passing parameters, functions may completely replace CSS + HTML + Javascript system.
I'll try to explain it comparing CSS + HTML code to function embracing code:
The above code, containing multiple syntax components for CSS + HTML, could be expressed by the following built-in functions (I'm gonna use a custom lambda calculus syntax I plan to use in my project):
The operator
Thinking further, Lambda calculus allows us to push boundaries towards scripting without need for Javascript.
To form a new UI functions we can reuse later, we form expressions like:
In the above example, our function is defined by currying, using function formation operator:
To use this function, we apply its definition to our new example:
resume
To resume, all the examples are based on function abstraction operator
requesting feedback
What are your thoughts? Do you like it? Do you hate it? Do you have any suggestions? Do you have any critics? Do you see any flaws? I'd appreciate any comment, even from less experienced programmers, could this
Anyone knows good resources on how to efficiently implement untyped lambda calculus?
I mean, it's pretty clear how to do it somehow to an average programmer, but since it's an old paradigm used in existing functional languages for fifty years, are there pitfalls to avoid, or hints to follow on efficient implementation?
base idea
Do you ever feel CSS + HTML + Javascript is a bit cumbersome relict that only got bloated with specific fixes over last thirty or so years? I'm currently working on a neat replacement for those, based only on lambda calculus. Functions are cornerstone of lambda calculus. Function application is a broadly unrecognized powerful formation with a property that all the laying out of HTML elements could entirely be replaced by functions. And since functions may be used for result computation, along simply passing parameters, functions may completely replace CSS + HTML + Javascript system.
I'll try to explain it comparing CSS + HTML code to function embracing code:
HTML:
... other contents goes here ...
<a href='someaddress' style='color:blue; font:Arial 10px'>sometext</a>
... other contents goes here ...
The above code, containing multiple syntax components for CSS + HTML, could be expressed by the following built-in functions (I'm gonna use a custom lambda calculus syntax I plan to use in my project):
Code:
... other contents go here ...
(
(
<a>
<- (<href> <- 'someaddress')
<- (<color> <- blue)
<- (
<font>
<- (<name> <- Arial)
<- (<size> <- 10px)
)
)
<- sometext
)
... other contents go here ...
The operator
<-
applies parameters from its right side to function from its left side. All the functions from the example are predefined parts of user interface for laying out contents, internally defined by currying. The code already shows some uniform appearance comparing to its CSS + HTML equivalent using more complex syntax.Thinking further, Lambda calculus allows us to push boundaries towards scripting without need for Javascript.
To form a new UI functions we can reuse later, we form expressions like:
Code:
<lnk> -> // currying parameter 1
<txt> -> // currying parameter 2
(
(
<a>
<- (<href> <- <lnk>) //applying parameter 1
<- (<color> <- blue)
<- (
<font>
<- (<name> <- Arial)
<- (<size> <- 10px)
)
)
<- <txt> // applying parameter 2
)
In the above example, our function is defined by currying, using function formation operator:
->
.To use this function, we apply its definition to our new example:
Code:
(
<myLink> -> // here we accept a parameter for later reuse
(
... other contents go here ...
(
<myLink> //reusing <myLink> for laying out the first link
<- 'someaddress1'
<- sometext1
)
... other contents go here ...
(
<myLink> //reusing <myLink> for laying out the second link
<- 'someaddress2'
<- sometext2
)
... other contents go here ...
)
) <- (... definition from above ...) // here we apply the above function as the parameter
resume
To resume, all the examples are based on function abstraction operator
->
and function application operator <-
. These operators correspond to their exact equivalents in lambda calculus, semantics are the same, only syntax is different. Compare this simplicity and minimalism to syntax currently used in CSS + HTML + Javascript, noting that it is equally powerful due to the fact that lambda calculus represents Turing complete language embodiment. This is not my invention, lambda calculus exists for almost 90 years now, and is basis for functional languages like Haskell, but I think things are overcomplicated in those languages. This is my attempt to simplify its use, and to apply it to web browser technology.requesting feedback
What are your thoughts? Do you like it? Do you hate it? Do you have any suggestions? Do you have any critics? Do you see any flaws? I'd appreciate any comment, even from less experienced programmers, could this
->
+ <-
system even compare to the current CSS + HTML + Javascript technology, and would you prefer the proposed technology to the current mainstream web browser technology?
Last edited: