Functional programming: Difference between revisions

Content deleted Content added
mNo edit summary
Tags: Reverted Visual edit
Revert. To quote someone, use reliable, independent sources to indicate to reader who they are and why their assessment is encyclopedically important enough to include.
Line 9:
 
Functional programming has its roots in [[academia]], evolving from the [[lambda calculus]], a formal system of computation based only on functions. Functional programming has historically been less popular than imperative programming, but many functional languages are seeing use today in industry and education, including [[Common Lisp]], [[Scheme (programming language)|Scheme]],<ref name="clinger1987"/><ref name="hartheimer1987"/><ref name="kidd2007"/><ref name="cleis2006"/> [[Clojure]], [[Wolfram Language]],<ref name="reference.wolfram.com">{{cite web |title=Wolfram Language Guide: Functional Programming |url=http://reference.wolfram.com/language/guide/FunctionalProgramming.html |year=2015 |access-date=2015-08-24}}</ref><ref name="Amath-CO"/> [[Racket (programming language)|Racket]],<ref name="racket-video-games"/> [[Erlang (programming language)|Erlang]],<ref name="erlang-faq"/><ref name="armstrong2007"/><ref name="larson2009"/> [[Elixir (programming language)|Elixir]],<ref>{{Cite web|title=The Elixir Programming Language|url=https://elixir-lang.org/|access-date=2021-02-14}}</ref> [[OCaml]],<ref name="minksy2008"/><ref name="leroy2007"/> [[Haskell]],<ref name="haskell-industry"/><ref name="hudak2007"/> and [[F Sharp (programming language)|F#]].<ref name="quantFSharp">{{cite conference |last=Mansell |first=Howard |title=Quantitative Finance in F# |url=http://cufp.galois.com/2008/abstracts.html#MansellHoward |year=2008 |conference=CUFP 2008 |access-date=2009-08-29 |archivedate=2015-07-08 |archiveurl=https://web.archive.org/web/20150708125937/http://cufp.galois.com/2008/abstracts.html#MansellHoward |url-status=dead }}</ref><ref name="businessAppsFSharp">{{cite conference |last=Peake |first=Alex |title=The First Substantial Line of Business Application in F# |url=http://cufp.galois.com/2009/abstracts.html#AlexPeakeAdamGranicz |year=2009 |conference=CUFP 2009 |access-date=2009-08-29 |archive-url=https://web.archive.org/web/20091017070140/http://cufp.galois.com/2009/abstracts.html#AlexPeakeAdamGranicz |archive-date=2009-10-17 |url-status=dead }}</ref> [[Lean (proof assistant)|Lean]] is a functional programming language commonly used for verifying mathematical theorems.<ref>{{cite conference |conference=Conference on Automated Deduction |title=The Lean 4 Theorem Prover and Programming Language |last1=de Moura |first1=Leonardo |last2=Ullrich |first2=Sebastian |date=July 2021 |book-title=Lecture Notes in Artificial Intelligence |volume=12699 |pages=625–635 |issn=1611-3349 |doi=10.1007/978-3-030-79876-5_37 |doi-access=free}}</ref> Functional programming is also key to some languages that have found success in specific domains, like [[JavaScript]] in the Web,<ref>{{Cite web|last=Banz|first=Matt|date=2017-06-27|title=An introduction to functional programming in JavaScript|url=https://opensource.com/article/17/6/functional-javascript|access-date=2021-01-09|website=Opensource.com|language=en}}</ref> [[R (programming language)|R]] in statistics,<ref name="useR"/><ref name="Chambers"/> [[J (programming language)|J]], [[K (programming language)|K]] and [[Q (programming language from Kx Systems)|Q]] in financial analysis, and [[XQuery]]/[[XSLT]] for [[XML]].<ref name="Novatchev"/><ref name="Mertz"/> Domain-specific declarative languages like [[SQL]] and [[Lex (software)|Lex]]/[[Yacc]] use some elements of functional programming, such as not allowing [[mutable object|mutable values]].<ref name="Chamberlin_Boyce"/> In addition, many other programming languages support programming in a functional style or have implemented features from functional programming, such as [[C++11]], [[C Sharp (programming language)|C#]],<ref>{{Citation|title=Functional Programming with C# - Simon Painter - NDC Oslo 2020| date=8 August 2021 |url=https://www.youtube.com/watch?v=gvyTB4aMI4o| archive-url=https://ghostarchive.org/varchive/youtube/20211030/gvyTB4aMI4o| archive-date=2021-10-30|language=en|access-date=2021-10-23}}{{cbignore}}</ref> [[Kotlin (programming language)|Kotlin]],<ref name=":0">{{Cite web|url=https://kotlinlang.org/docs/tutorials/kotlin-for-py/functional-programming.html|title=Functional programming - Kotlin Programming Language|website=Kotlin|access-date=2019-05-01}}</ref> [[Perl]],<ref>{{cite book |last=Dominus |first=Mark J. |author-link=Mark Jason Dominus |title=Higher-Order Perl |publisher=[[Morgan Kaufmann]] |year=2005 |isbn=978-1-55860-701-9 |title-link=Higher-Order Perl}}</ref> [[PHP]],<ref>{{cite book |last=Holywell |first=Simon |title=Functional Programming in PHP |publisher=php[architect] |year=2014 |isbn=9781940111056}}</ref> [[Python (programming language)|Python]],<ref name="AutoNT-13">{{cite web |url=https://www.python.org/community/pycon/dc2004/papers/24/metaclasses-pycon.pdf |archive-url=https://web.archive.org/web/20090530030205/http://www.python.org/community/pycon/dc2004/papers/24/metaclasses-pycon.pdf |archive-date=30 May 2009 |title=Python Metaclasses: Who? Why? When? |last=The Cain Gang Ltd. |access-date=27 June 2009 |url-status=dead |df=dmy-all }}</ref> [[Go (programming language)|Go]],<ref>{{Cite web|last=|first=|date=22 December 2020|title=GopherCon 2020: Dylan Meeus - Functional Programming with Go|url=https://www.youtube.com/watch?v=wqs8n5Uk5OM|access-date=|website=YouTube}}</ref> [[Rust (programming language)|Rust]],<ref>{{Cite web|title=Functional Language Features: Iterators and Closures - The Rust Programming Language|url=https://doc.rust-lang.org/book/ch13-00-functional-features.html|access-date=2021-01-09|website=doc.rust-lang.org}}</ref> [[Raku (programming language)|Raku]],<ref>{{cite web|last=Vanderbauwhede |first=Wim |url=https://wimvanderbauwhede.github.io/articles/decluttering-with-functional-programming/|archive-url=https://web.archive.org/web/20200728013926/https://wimvanderbauwhede.github.io/articles/decluttering-with-functional-programming/|archive-date=28 July 2020|title=Cleaner code with functional programming |date=18 July 2020 |access-date=6 October 2020}}</ref> [[Scala (programming language)|Scala]],<ref name="effective-scala"/> and [[Java (programming language)|Java (since Java 8)]].<ref name="java-8-javadoc"/>
 
[[Composability]] and [[Stateless protocol|statelessness]] are two tenets of functional programming. According to Scott Wlaschin, these features make functional programming a good fit for [[microservices]] architectures.<ref name=":1">{{Cite book |last=Wlaschin |first=Scott |title=Domain Modeling Made Functional: Tackle Software Complexity with Domain-Driven Design and F# |isbn=978-1680502541}}</ref>
 
== History ==
Line 339 ⟶ 337:
 
In particular, [[Scheme (programming language)|Scheme]] has been a relatively popular choice for teaching programming for years.<ref>{{Cite web |title=Why Scheme for Introductory Programming? |url=https://home.adelphi.edu/sbloch/class/pbd/testimonials/ |access-date=2024-04-29 |website=home.adelphi.edu}}</ref><ref>{{Cite web |last=Staff |first=IMACS |date=2011-06-03 |title=What Is Scheme & Why Is it Beneficial for Students? |url=https://www.imacs.org/learn-computer-programming-using-scheme/ |access-date=2024-04-29 |website=IMACS – Making Better Thinkers for Life |language=en-US}}</ref>
 
== Error handling ==
 
Railway-Oriented Programming is a functional programming paradigm primarily proposed by Scott Wlaschin, which focuses on managing the flow of data and error handling in a structured manner. The concept utilizes the metaphor of railway tracks, where one track represents the happy path (successful execution) and the other represents the failure path (error handling). <ref name=":1" />
 
== See also ==