Talk:Function-level programming

From Esolang
Jump to navigation Jump to search

The Quote

The quote above from John Backus, which really speaks of programming with functionals, made me think for a long time about what a proper functional programming language should look like.

Here are a few examples:

The definition (==) of fact1 is a simple constant definition for use by the interpreter.

   fact1 == prod ° '1 , iota
   
   body ° 'fact1
   --> (prod ° (1 _q) , iota _s)
   
   fact1 ° 7
   --> 5040

The definition (:=) of fact2 is referred to as the compiler run performed by the interpreter. Such a compiler run can be designed very flexibly with the appropriate arguments.

   #fact2 °           fact2 := 'prod comp (quote ° 1) comma (single ° 'iota)
   --> (prod ° (1 _q) , iota _s)
   
   (#fact2 app 7) °   fact2 := 'prod comp (quote ° 1) comma (single ° 'iota)
   --> 5040

The application (app) that is based on the generated value of fact2 is called a program run.

With the Prelude functions:

   comp   == (prop ° [0], '° ,[1],) ° ee
   comma  == (prop ° [0], (',) ,[1],) ° ee
   single ==  prop ° id, '_s ,( ),
   quote  ==  prop ° id, '_q ,( ),
   prod   == (* \)      // Insertr

... in the end, the clearer wording wins. Fpstefan (talk) 23:09, 2 November 2025 (UTC)