Talk:Functional programming: Difference between revisions

Content deleted Content added
Notification of altered sources needing review #IABot (v1.5.5)
m Archiving 2 discussion(s) to Talk:Functional programming/Archive 3) (bot
Line 78:
 
"Functional" is a manner of abstraction, but "pure functional" gives the nice guarantees like referential transparency and lazy evaluation. --[[Special:Contributions/72.226.86.106|72.226.86.106]] ([[User talk:72.226.86.106|talk]]) 02:37, 11 July 2015 (UTC)
 
== Functional programming in non-functional languages ==
The elephant in the room is javascript. Readers of this article are most likely using a client with an embedded javascript engine... Javascript/ECMAScript should be at the top of the list of non-functional languages having "functional features". <small><span class="autosigned">—&nbsp;Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[User:Kwagmire|Kwagmire]] ([[User talk:Kwagmire|talk]] • [[Special:Contributions/Kwagmire|contribs]]) 23:02, 27 July 2014 (UTC)</span></small><!-- Template:Unsigned --> <!--Autosigned by SineBot-->
 
== author bias ==
 
this article is written with a clear bias by the author. <span style="font-size: smaller;" class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/38.88.190.138|38.88.190.138]] ([[User talk:38.88.190.138|talk]]) 20:34, 20 August 2014 (UTC)</span><!-- Template:Unsigned IP --> <!--Autosigned by SineBot-->
 
===Functional Programming not mathematical functions===
 
It is a style of simply building a program using functions. The functions are complete of them selves. Not having side effects or creating them. Functional programming is present in early languages as described about lisp. We can say every computer action is mathematical. And that is correct. However puting everything in the same class does not help. Computers work with characters that are encoded as numbers. That being said means the leadin should express the concepts in layman terms.
 
Functional programming languages should not be part of the definition. Functional programming has been utilized almost from the beginning of computer development. Functions waere utilized before programming language devalopment. Early computing utilizing subroutines were common on the first stored memory computers. Many programs were nearly all calls to Subroutines that implemented higher level operations. Multiply and divide were subroutines on early machines having only add and subtract. Having care memory subroutines remained in memory when the computer was shut down.
 
As a programmer we think of functions as being typed. Therefore a mathematical function is one that is of numeric type.
 
Functional programming is more a concept of functions being defined such that they always operate consistantly. But a useful program has to operate on something external. A function that reads data is not consistant in what it returns. A pure functional language is of little use as it has no input abilities.
 
An example of a pure functional language would be early Mathcad versions. Before I/O was added. Like a spread sheet all input data is coded in the source. Pure functional languages would have input data coded into the program. And that is workable for some applications like mathcad. Design (engineering) active documents are a good example of usable (practical) functional programming languages.
 
VisSim is another graphical (functional) programming language. In actuality some functions are dependent on their current state. Integration for example. But sense integration is a mathematically defined function having long history I think such functions built into the language may be exceptions. Aftor all it is a time dependent simulation language.
 
Anyway functional programming is a hard thing to explain.
 
An example of a functional language having input is Treemeta. The input stream is the input to the function and its output an abstract syntax tree representation of of its input.
 
A syntax rule describes a language phrase to be recognized and returns success or failure. A rule always does the same thing with the same input character sequence. It is consistent as the same input always produces the same output.
 
Every syntax rule is compiled into a function. Because all rules take the same input argument (the position in the input stream) there is no need of a syntax rule having an argument list. The outputs are to language defined stacks.
 
For example a mathematical expression is a sequence of terms that are added or subtracted. Or could be a single term. Likewise a term is a sequence of factors (or divisors)...
 
An expression rule describes the mathematical form and it's transformation:
<pre>expr = term $(('+':ADD|'-':SUB)term!2)</pre> It is assumed that term will transform it's input in the same manor.
 
The language has three stacks. The call stack(containing function returns), node stack(contains nodes created by the : operator), and parse stack that contains tokens and abstract tree structures created from nodes and parsed elements by the ! operator. The result of the expr would be a single term or an ADD or SUB tree on the parse stack. i.e. ADD[term,term] an ADD tree.
 
I would argue that these languages are unique functional programming languages having input.
[[User:Steamerandy|Steamerandy]] ([[User talk:Steamerandy|talk]]) 21:06, 16 January 2015 (UTC)
 
===Functional design programming===
 
Functional design was practiced on large scale programming project. Reservation systems are an example. Designed top down define all subsystems and functions before puting any code down. All functions were defined in detail as to their input, output and function. Layers of detail before coding. The allowed many programmers to work on the project. Forty plus programmers simultaneously worked on the Ramada Inn reservation systeam. The TWA flight reservation system was done the same way as many large scale projects are done. Very few of these functions have side effects. All side effect functions dealing with I/O or transaction messagong. The Ramada reservation system was a 40 man year project implemented in less then a year.
 
Top down functional design is closely related to functional programming.
[[User:Steamerandy|Steamerandy]] ([[User talk:Steamerandy|talk]]) 21:52, 16 January 2015 (UTC)
 
== D language? ==