fbpx
วิกิพีเดีย

การเขียนโปรแกรมเชิงฟังก์ชัน

ในวิทยาการคอมพิวเตอร์ การเขียนโปรแกรมเชิงฟังก์ชันเป็นกระบวนทัศน์การเขียนโปรแกรมที่รูปแบบการสร้างโครงสร้างและส่วนประกอบของโปรแกรมคอมพิวเตอร์ซึ่งปฏิบัติต่อการคำนวณว่าเป็นการประเมินผลฟังก์ชันทางคณิตศาสตร์และหลีกเลี่ยงการเปลี่ยนแปลงสถานะและข้อมูลที่เปลี่ยนแปลงได้ โดยเป็นกระบวนทัศน์การเขียนโปรแกรมเชิงประกาศซึ่งหมายความหรือการประกาศแทนข้อความสั่ง ในโปรแกรมเชิงฟังก์ชัน ค่าผลลัพธ์ของฟังก์ชันขึ้นอยู่กับ[ อาร์กิวเมนต์]ที่นำเข้าสู่ฟังก์ชันเท่านั้น ดังนั้นการเรียกฟังก์ชัน f สองครั้งด้วยค่าอาร์กิวเมนต์ x เดียวกันจะให้ค่าผลลัพธ์ f(x) เท่ากันทุกครั้ง การกำจัดผลข้างเคียง ได้แก่ การเปลี่ยนแปลงสถานะที่ไม่ขึ้นกับสิ่งที่นำเข้าฟังก์ชัน สามารถทำให้ง่ายขึ้นที่จะทำความเข้าใจและพยากรณ์พฤฒิกรรมของโปรแกรมซึ่งเป็นหนึ่งในแรงจูงใจของการพัฒนาของการเขียนโปรแกรมเชิงฟังก์ชัน

การเขียนโปรแกรมเชิงฟังก์ชันมีรากฐานมาจากแคลคูลัสแลมบ์ดาซึ่งเป็นระบบรูปนัยที่พัฒนาในคริสต์ทศวรรษ 1930 เพื่อค้นEntscheidungsproblem นิยามของฟังก์ชัน การประยุกต์ฟังก์ชัน และการเรียกซ้ำ ภาษาการใส่รายละเอียดเพิ่มจากแคลคูลัสแลมบ์ดา กระบวนทัศน์การเขียนโปรแกรมเชิงประกาศที่เป็นที่รู้จักอื่น ๆ การเขียนโปรแกรมเชิงตรรกะ มีพื้นฐานอยู่บนความสัมพันธ์เชิงตรรกะ

ในกลับโปรแกรมเชิงคำสั่งเปลี่ยนสถานะด้วยคำสั่งในภาษาต้นทาง ตัวอย่างที่ง่ายที่สุดคือการกำหนดค่า การเขียนโปรแกรมเชิงคำสั่งไม่มีฟังก์ชันในความหมายแบบคณิตศาสตร์แต่มีในความหมายแบบซับรูทีน ซึ่งมีผลข้างเคียงที่อาจะเปลี่ยนค่าของสถานะของโปรแกรมได้ ฟังก์ชันที่ไม่คืนค่าจึงสมเหตุสมผลเพราะขาดความโปร่งใสในการอ้างอิง ได้แก่นิพจน์เดียวกันทางภาษาสามารถให้ผลลัพธ์ที่มีค่าต่างกันได้ในเวลาที่ต่างกันขึ้นกับสถานะของโปรแกรมที่กำลังกระทำการ

ภาษาโปรแกรมเชิงฟังก์ชันโดยเฉพาะภาษาโปรแกรมเชิงฟังก์ชันบริสุทธิ เช่น ภาษาโฮปถูกในความสำคัญในวงการวิชาการมากกว่าในการพัฒนาซอฟต์แวร์เชิงพาณิชย์ อย่างไรก็ตามภาษาโปรแกรมที่มีชื่อเสียงซึ่งสนับสนุนการเขียนโปรแกรมเชิงฟังก์ชัน เช่น ภาษาคอมมอนลิสป์ ภาษา Scheme ภาษา Clojure ภาษา Wolfram (หรือ ภาษา Mathematica) ภาษา Racket ภาษาเออร์แลง ภาษา OCaml ภาษา Haskell และภาษาเอฟชาร์ป ใช้ในโปรแกรมประยุกต์เชิงอุตสาหกรรมและเชิงพาณิชย์โดยองค์กรอย่างกว้างขวาง การเขียนโปรแกรมเชิงฟังก์ชันยังได้รับการรองรับในภาษาเขียนโปรแกรมเฉพาะทางบางภาษา เช่น ภาษาอาร์ (สถิติ) ภาษาเจ ภาษาเค และภาษาคิวจาก Kx Systems (การวิเคราะห์ทางการคลัง) XQuery/XSLT (เอกซ์เอ็มแอล) และภาษาโอปอล ภาษาเชิงประกาศเฉพาะทางที่ใช้งานอย่างกว้างขวางเช่น ภาษาสอบถามเชิงโครงสร้าง และ Lex/Yacc ใช้บางส่วนประกอบของการเขียนโปรแกรมเชิงฟังก์ชันโดยเฉพาะใน eschewing วัตถุที่เปลี่ยนแปลงได้.

การเขียนโปรแกรมเชิงฟังก์ชันสามารถทำได้ในภาษาที่ไม่ได้ออกมาเฉพาะสำหรับการเขียนโปรแกรมเชิงฟังก์ชัน ตัวอย่างเช่น ภาษาเพิร์ลซึ่งเป็นภาษาโปรแกรมเชิงคำสั่งมีบทหนึ่งของหนังสือที่อธิบายว่าประยุกต์แนวคิดการเขียนโปรแกรมเชิงฟังก์ชันอย่างไร นี้ยังเป็นจริงสำหรับภาษาพีเอชพี C++11, ภาษาจาวา 8 และภาษาซีชาร์ป 3.0 ภาษาจูเลียก็เสนอความสามารถการเขียนโปรแกรมเชิงฟังก์ชันเช่นกัน กรณีที่น่าสนใจคือภาษาสกาลา – มักเขียนในเชิงฟังก์ชัน แต่ก็มีการแสดงตนของผลข้างเคียงและสถานะที่เปลี่ยนแปลงได้ ซึ่งทำให้จัดอยู่ในบริเวณสีเทาระหว่างภาษาเชิงคำสั่งและเชิงฟังก์ชัน

อ้างอิง

  1. "Declaration vs. expression style - HaskellWiki".
  2. "Declaration vs. expression style - HaskellWiki".
  3. Hudak, Paul (September 1989). "Conception, evolution, and application of functional programming languages" (PDF). ACM Computing Surveys. 21 (3): 359–411. doi:10.1145/72551.72554.
  4. Clinger, Will (1987). "MultiTasking and MacScheme". MacTech. 3 (12). สืบค้นเมื่อ 2008-08-28.
  5. Hartheimer, Anne (1987). "Programming a Text Editor in MacScheme+Toolsmith". MacTech. 3 (1). สืบค้นเมื่อ 2008-08-28.
  6. Kidd, Eric. Terrorism Response Training in Scheme. CUFP 2007. สืบค้นเมื่อ 2009-08-26.
  7. Cleis, Richard. Scheme in Space. CUFP 2006. สืบค้นเมื่อ 2009-08-26.
  8. "The useR! 2006 conference schedule includes papers on the commercial use of R". R-project.org. 2006-06-08. สืบค้นเมื่อ 2011-06-20.
  9. Chambers, John M. (1998). Programming with Data: A Guide to the S Language. Springer Verlag. pp. 67–70. ISBN 978-0-387-98503-9.
  10. "Wolfram Language Guide: Functional Programming". 2015. สืบค้นเมื่อ 2015-08-24.
  11. (PDF). คลังข้อมูลเก่า เก็บจาก แหล่งเดิม (PDF) เมื่อ 2012-12-15. สืบค้นเมื่อ 2011-08-08.
  12. "Who uses Erlang for product development?". Frequently asked questions about Erlang. สืบค้นเมื่อ 2007-08-05.
  13. Armstrong, Joe (June 2007). A history of Erlang. Third ACM SIGPLAN Conference on History of Programming Languages. San Diego, California. สืบค้นเมื่อ 2009-08-29.
  14. Larson, Jim (March 2009). "Erlang for concurrent programming". Communications of the ACM. 52 (3): 48. doi:10.1145/1467247.1467263.
  15. Minsky, Yaron; Weeks, Stephen (July 2008). "Caml Trading — experiences with functional programming on Wall Street". Journal of Functional Programming. Cambridge University Press. 18 (4): 553–564. doi:10.1017/S095679680800676X. สืบค้นเมื่อ 2008-08-27.
  16. Leroy, Xavier. Some uses of Caml in Industry (PDF). CUFP 2007. สืบค้นเมื่อ 2009-08-26.
  17. "Haskell in industry". Haskell Wiki. สืบค้นเมื่อ 2009-08-26. Haskell has a diverse range of use commercially, from aerospace and defense, to finance, to web startups, hardware design firms and lawnmower manufacturers.
  18. Hudak, Paul; Hughes, J.; Jones, S. P.; Wadler, P. (June 2007). A history of Haskell: being lazy with class. Third ACM SIGPLAN Conference on History of Programming Languages. San Diego, California. doi:10.1145/1238844.1238856. สืบค้นเมื่อ 2013-09-26.
  19. Mansell, Howard (2008). . CUFP 2008. คลังข้อมูลเก่า เก็บจาก แหล่งเดิม เมื่อ 2015-07-08. สืบค้นเมื่อ 2009-08-29.
  20. Peake, Alex (2009). . CUFP 2009. คลังข้อมูลเก่า เก็บจาก แหล่งเดิม เมื่อ 2009-10-17. สืบค้นเมื่อ 2009-08-29.
  21. Department of Applied Math, University of Colorado. . คลังข้อมูลเก่า เก็บจาก แหล่งเดิม เมื่อ 2007-11-13. สืบค้นเมื่อ 2006-08-28.
  22. Dimitre Novatchev. "The Functional Programming Language XSLT — A proof through examples". TopXML. สืบค้นเมื่อ May 27, 2006.
  23. David Mertz. "XML Programming Paradigms (part four): Functional Programming approached to XML processing". IBM developerWorks. สืบค้นเมื่อ May 27, 2006.
  24. OPtimized Applicative Language
  25. Donald D. Chamberlin and Raymond F. Boyce (1974). "SEQUEL: A structured English query language". Proceedings of the 1974 ACM SIGFIDET: 249–264.
  26. Dominus, Mark J. (2005). Higher-Order Perl. Morgan Kaufmann. ISBN 1-55860-701-3.
  27. Holywell, Simon (2014). Functional Programming in PHP. php[architect]. ISBN 9781940111056.
  28. "Effective Scala". Scala Wiki. สืบค้นเมื่อ 2012-02-21. Effective Scala.

การเข, ยนโปรแกรมเช, งฟ, งก, บทความน, องการการจ, ดหน, ดหมวดหม, ใส, งก, ภายใน, หร, อเก, บกวาดเน, อหา, ให, ณภาพด, ณสามารถปร, บปร, งแก, ไขบทความน, ได, และนำป, ายออก, จารณาใช, ายข, อความอ, นเพ, อช, ดข, อบกพร, องในว, ทยาการคอมพ, วเตอร, เป, นกระบวนท, ศน, การเข, ยนโปร. bthkhwamnitxngkarkarcdhna cdhmwdhmu islingkphayin hruxekbkwadenuxha ihmikhunphaphdikhun khunsamarthprbprungaekikhbthkhwamniid aelanapayxxk phicarnaichpaykhxkhwamxunephuxchichdkhxbkphrxnginwithyakarkhxmphiwetxr karekhiynopraekrmechingfngkchnepnkrabwnthsnkarekhiynopraekrmthirupaebbkarsrangokhrngsrangaelaswnprakxbkhxngopraekrmkhxmphiwetxrsungptibtitxkarkhanwnwaepnkarpraeminphlfngkchnthangkhnitsastraelahlikeliyngkarepliynaeplngsthanaaelakhxmulthiepliynaeplngid odyepnkrabwnthsnkarekhiynopraekrmechingprakassunghmaykhwam 1 hruxkarprakas 2 aethnkhxkhwamsng inopraekrmechingfngkchn khaphllphthkhxngfngkchnkhunxyukb xarkiwemnt thinaekhasufngkchnethann dngnnkareriykfngkchn f sxngkhrngdwykhaxarkiwemnt x ediywkncaihkhaphllphth f x ethaknthukkhrng karkacdphlkhangekhiyng idaek karepliynaeplngsthanathiimkhunkbsingthinaekhafngkchn samarththaihngaykhunthicathakhwamekhaicaelaphyakrnphvthikrrmkhxngopraekrmsungepnhnunginaerngcungickhxngkarphthnakhxngkarekhiynopraekrmechingfngkchnkarekhiynopraekrmechingfngkchnmirakthanmacakaekhlkhulsaelmbdasungepnrabbrupnythiphthnainkhristthswrrs 1930 ephuxkhnEntscheidungsproblem niyamkhxngfngkchn karprayuktfngkchn aelakareriyksa phasakarisraylaexiydephimcakaekhlkhulsaelmbda krabwnthsnkarekhiynopraekrmechingprakasthiepnthiruckxun karekhiynopraekrmechingtrrka miphunthanxyubnkhwamsmphnthechingtrrka 3 inklbopraekrmechingkhasngepliynsthanadwykhasnginphasatnthang twxyangthingaythisudkhuxkarkahndkha karekhiynopraekrmechingkhasngimmifngkchninkhwamhmayaebbkhnitsastraetmiinkhwamhmayaebbsbruthin sungmiphlkhangekhiyngthixacaepliynkhakhxngsthanakhxngopraekrmid fngkchnthiimkhunkhacungsmehtusmphlephraakhadkhwamoprngisinkarxangxing idaekniphcnediywknthangphasasamarthihphllphththimikhatangknidinewlathitangknkhunkbsthanakhxngopraekrmthikalngkrathakar 3 phasaopraekrmechingfngkchnodyechphaaphasaopraekrmechingfngkchnbrisuththi echn phasaohpthukinkhwamsakhyinwngkarwichakarmakkwainkarphthnasxftaewrechingphanichy xyangirktamphasaopraekrmthimichuxesiyngsungsnbsnunkarekhiynopraekrmechingfngkchn echn phasakhxmmxnlisp phasa Scheme 4 5 6 7 phasa Clojure 8 9 phasa Wolfram 10 hrux phasa Mathematica phasa Racket 11 phasaexxraelng 12 13 14 phasa OCaml 15 16 phasa Haskell 17 18 aelaphasaexfcharp 19 20 ichinopraekrmprayuktechingxutsahkrrmaelaechingphanichyodyxngkhkrxyangkwangkhwang karekhiynopraekrmechingfngkchnyngidrbkarrxngrbinphasaekhiynopraekrmechphaathangbangphasa echn phasaxar sthiti 21 phasaec phasaekh aelaphasakhiwcak Kx Systems karwiekhraahthangkarkhlng XQuery XSLT exksexmaexl 22 23 aelaphasaoxpxl 24 phasaechingprakasechphaathangthiichnganxyangkwangkhwangechn phasasxbthamechingokhrngsrang aela Lex Yacc ichbangswnprakxbkhxngkarekhiynopraekrmechingfngkchnodyechphaain eschewing wtthuthiepliynaeplngid 25 karekhiynopraekrmechingfngkchnsamarththaidinphasathiimidxxkmaechphaasahrbkarekhiynopraekrmechingfngkchn twxyangechn phasaephirlsungepnphasaopraekrmechingkhasngmibthhnungkhxnghnngsuxthixthibaywaprayuktaenwkhidkarekhiynopraekrmechingfngkchnxyangir 26 niyngepncringsahrbphasaphiexchphi 27 C 11 phasacawa 8 aelaphasasicharp 3 0 phasacueliykesnxkhwamsamarthkarekhiynopraekrmechingfngkchnechnkn krnithinasnickhuxphasaskala 28 mkekhiyninechingfngkchn aetkmikaraesdngtnkhxngphlkhangekhiyngaelasthanathiepliynaeplngid sungthaihcdxyuinbriewnsietharahwangphasaechingkhasngaelaechingfngkchnxangxing aekikh Declaration vs expression style HaskellWiki Declaration vs expression style HaskellWiki 3 0 3 1 Hudak Paul September 1989 Conception evolution and application of functional programming languages PDF ACM Computing Surveys 21 3 359 411 doi 10 1145 72551 72554 Clinger Will 1987 MultiTasking and MacScheme MacTech 3 12 subkhnemux 2008 08 28 Hartheimer Anne 1987 Programming a Text Editor in MacScheme Toolsmith MacTech 3 1 subkhnemux 2008 08 28 Kidd Eric Terrorism Response Training in Scheme CUFP 2007 subkhnemux 2009 08 26 Cleis Richard Scheme in Space CUFP 2006 subkhnemux 2009 08 26 The useR 2006 conference schedule includes papers on the commercial use of R R project org 2006 06 08 subkhnemux 2011 06 20 Chambers John M 1998 Programming with Data A Guide to the S Language Springer Verlag pp 67 70 ISBN 978 0 387 98503 9 Wolfram Language Guide Functional Programming 2015 subkhnemux 2015 08 24 State Based Scripting in Uncharted 2 PDF khlngkhxmuleka ekbcak aehlngedim PDF emux 2012 12 15 subkhnemux 2011 08 08 Who uses Erlang for product development Frequently asked questions about Erlang subkhnemux 2007 08 05 Armstrong Joe June 2007 A history of Erlang Third ACM SIGPLAN Conference on History of Programming Languages San Diego California subkhnemux 2009 08 29 Larson Jim March 2009 Erlang for concurrent programming Communications of the ACM 52 3 48 doi 10 1145 1467247 1467263 Minsky Yaron Weeks Stephen July 2008 Caml Trading experiences with functional programming on Wall Street Journal of Functional Programming Cambridge University Press 18 4 553 564 doi 10 1017 S095679680800676X subkhnemux 2008 08 27 Leroy Xavier Some uses of Caml in Industry PDF CUFP 2007 subkhnemux 2009 08 26 Haskell in industry Haskell Wiki subkhnemux 2009 08 26 Haskell has a diverse range of use commercially from aerospace and defense to finance to web startups hardware design firms and lawnmower manufacturers Hudak Paul Hughes J Jones S P Wadler P June 2007 A history of Haskell being lazy with class Third ACM SIGPLAN Conference on History of Programming Languages San Diego California doi 10 1145 1238844 1238856 subkhnemux 2013 09 26 Mansell Howard 2008 Quantitative Finance in F CUFP 2008 khlngkhxmuleka ekbcak aehlngedim emux 2015 07 08 subkhnemux 2009 08 29 Peake Alex 2009 The First Substantial Line of Business Application in F CUFP 2009 khlngkhxmuleka ekbcak aehlngedim emux 2009 10 17 subkhnemux 2009 08 29 Department of Applied Math University of Colorado Functional vs Procedural Programming Language khlngkhxmuleka ekbcak aehlngedim emux 2007 11 13 subkhnemux 2006 08 28 Dimitre Novatchev The Functional Programming Language XSLT A proof through examples TopXML subkhnemux May 27 2006 David Mertz XML Programming Paradigms part four Functional Programming approached to XML processing IBM developerWorks subkhnemux May 27 2006 OPtimized Applicative Language Donald D Chamberlin and Raymond F Boyce 1974 SEQUEL A structured English query language Proceedings of the 1974 ACM SIGFIDET 249 264 Dominus Mark J 2005 Higher Order Perl Morgan Kaufmann ISBN 1 55860 701 3 Holywell Simon 2014 Functional Programming in PHP php architect ISBN 9781940111056 Effective Scala Scala Wiki subkhnemux 2012 02 21 Effective Scala ekhathungcak https th wikipedia org w index php title karekhiynopraekrmechingfngkchn amp oldid 9559777, wikipedia, วิกิ หนังสือ, หนังสือ, ห้องสมุด,

บทความ

, อ่าน, ดาวน์โหลด, ฟรี, ดาวน์โหลดฟรี, mp3, วิดีโอ, mp4, 3gp, jpg, jpeg, gif, png, รูปภาพ, เพลง, เพลง, หนัง, หนังสือ, เกม, เกม