How can I get started with functional programming? [closed]

梦想与她 提交于 2021-01-21 08:56:08

问题


With all the hype around functional programming, which are the best resources to getting started in functional programming [for a C# programmer]? I am not looking for C# 3.0 language improvements.


回答1:


I think for a C# developer with .NET background, the best way to enter functional programming is to learn F#.




回答2:


Shameless plug: I'm the co-author (well, glorified editor really :) of Real World Functional Programming. It's squarely aimed at people such as yourself. It teaches the principles of functional programming, mostly via F#, and also shows how you can apply the same principles in many cases in C#.

It assumes you know C# already, but introduces F# from scratch. It gives you enough knowledge of F# to get you started so you can experiment, but the aim is to teach a functional way of thinking rather than going into every nook and cranny of F# as a language. (In other words, if you want to start using F# as a production language, I'd get another book as well.)

It's not out yet, but you can get early access via the MEAP programme. Several chapters are available already, with more coming soon.




回答3:


Pick a functional language. Python has many functional features. Haskell is purely functional.

Go to Project Euler.

Solve some problems.

If you look at the Project Euler stats, Python and Haskell are very highly ranked.


Edit

Functional Programming in Python:

  • http://www.ibm.com/developerworks/library/l-prog.html
  • http://www.amk.ca/python/writing/functional
  • http://linuxgazette.net/109/pramode.html
  • http://www.slideshare.net/adambyrtek/functional-programming-with-python-516744
  • http://scott.andstuff.org/FunctionalPython
  • http://docs.python.org/tutorial/datastructures.html#functional-programming-tools
  • http://www.freenetpages.co.uk/hp/alan.gauld/tutfctnl.htm



回答4:


The free online version of Real World Haskell is a good, cheap way to get started.

Once you've done a few chapters, you'll be in a position to decide whether FP is for you, and whether you want to continue with Haskell or move on to some other language. You may even go on to buy the dead tree version (as I did).

The paradigms you learn from this book, especially the opening chapters, apply equally well to other functional languages. (I like to think my Javascript and Groovy benefited from my studying Haskell).




回答5:


Spend some time looking at Lisp or Scheme as they're the mother and father of functional programming. PLT Scheme is a great environment to play with Scheme. Get yourself a copy of The Little Schemer as it's a good introduction to Scheme and will help you get up to speed fairly quickly.

Once you've got your head around functional try doing some of the Project Euler problems in a functional way.




回答6:


I learned functional programming in college, using language Haskell.

In its homepage you most likely find what you need to get started :)

BTW, it takes a lot of practice to see the solution; algorithms, as such, are not what everybody's used to code in Object-Oriented, logic or procedural languages.




回答7:


I agree with Mehrdad Afshari. If you are familiar with C# start functional programming with F#. The syntax is similar to lambda expressions in C#.




回答8:


I've been liking learn you a haskell so far, it's pretty good for beginners.



来源:https://stackoverflow.com/questions/638222/how-can-i-get-started-with-functional-programming

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!