Previous | Next --- Slide 8 of 50
Back to Lecture Thumbnails
suninhouse

Does it mean functional programming languages are inherently more suitable for parallelism?

Jonathan

I think that in general functional programming languages, or at least programming in a functional style is great for parallelism. One of the core ideas in functional programming is minimizing shared state by breaking the problem up into side-effect free functions, and this is great for parallel programming because less shared state means fewer variables that need to be protected by some form of synchronization.

lonelymoon

I am not familiar with this Haskell concept of langauge. Is it correct that for defining "map" with (a->b)->seq a -> seq b, (a->b) is f, and this function f is applied to the arrow in seq a-> seq b? As similarly, if we want to define the function map 2 with function g (for example), can I say that map2:: g -> seq a -> seq b?

wooloo

@lonelymoon Not sure this answers your question completely, but to my understanding, the Haskell line map :: (a -> b) -> seq a -> seq b is a function type signature, not a function declaration. This line defines the type of map to have arguments of type (a -> b) (a function from a to b) and seq a (a sequence of a), and return type seq b (a sequence of b). We can also think of map as turning a function from a->b into a function from seq a->seq b.

lonelymoon

@wooloo Thank you. :)

kayvonf

Confirming the answers above are correct! Good job everyone.

Please log in to leave a comment.