Answer the question
In order to leave comments, you need to log in
How to functionally program for parallel computing in C#?
I hear a lot that functional programming is the future, and at the same time they give an example of F # and Lisp. At the same time, I come across material that C # also keeps up with the times and has functionality. But there is no material anywhere to describe C# as functional parallel programming.
Where and what material on this topic is there?
.
At the beginning, I thought that, they say, F # is more promising than C #, the syntax scared me in F #. Or maybe the problem is not in the language, but in the way of programming? Why learn a new bike when you can use the old one?
I mean not just parallel programming, namely, that it be functional. So that you do not have to think about debugging and mutability of objects.
Answer the question
In order to leave comments, you need to log in
I hear a lot that functional programming is the future
Hey!
First, .net languages are translated into an intermediate language (IL) when they are compiled. What can be written in F# can also be written in C#, there will be no difference. F# is chosen only because of the syntax (who likes it).
That is, in F # you will write in a functional style, but this will not give any advantages over c #. Lisp and F# are also incorrect to compare, they have different compilers and different processing mechanisms. If you want, try functional languages like lisp. The assertion that the future belongs to him is debatable. The enterprise uses c# and java. And will apply in the future.
Second. For parallel computing, it is not necessary to write in functional languages. Parallel computing is not difficult to do in c#, but, as already mentioned, not all operations can be parallelized, it does not depend on the language. And sometimes you don't have to do it. For example, web programming. The server has its own parallelization mechanisms; it simultaneously processes many different requests from users. At the same time, the programmer does not need to write anything related to parallelism.
Request from the user - data validation - request to the database - response packing - response return. Purely theoretically, it is possible to parallelize a single step, but why? Not the fact that it will add productivity.
For the info you asked, check out lambda calculations in c#
In F #, IMHO, the most beautiful and understandable syntax of all purely FP-shnyh PL. Learn more and you will understand. Another question is expediency... Personally, I don't see the point in either F# or Lisp, Clojure, Haskell... Well, there are almost no vacancies for them. And why teach something that is not in demand. Another question is that in many modern languages there are elements of FP-ness. Even in pure C, you can pass function pointers as parameters, not to mention C#. Passing functions as parameters is the first step (higher order functions). The simplest example of monads is IEnumerable in C#, and Java 8 introduced the Optional type, the MayBe monad. So the best option is to combine functional techniques with OOP in "classical" languages.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question