Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

15
  • 2
    In a pure functional language with no global variables, then one assembly line cannot affect the other (unless it's feeding the other line input.) Theoretically any assembly lines that do not depend on one another can be executed in parallel, but I'm not sure if any compilers do this. Commented Jun 18, 2014 at 15:12
  • 3
    @GuidoAnselmi One way to think about it is that the assembly line in functional programming builds new outputs while leaving the inputs intact, whereas the assembly line in traditional OOP transforms the input. Commented Jun 18, 2014 at 15:24
  • 2
    This metaphor only makes sense in the "first-class functions/function composition" meaning of "function programming", not in the "no side-effects/declarative". Also, object-oriented programming doesn't necessarily have side-effects, so you can implement either a destructive or constructive assembly line with either OOP or this meaning of FP. OOP is more about encapsulation, message passing and polymorphism than it is about side-effects, it depends on how you model things. E.g. do you require referencial identity from start to end? Commented Jun 18, 2014 at 17:40
  • 3
    @bstamour: To be precise, one should write that (f . g) (x) means f(g(x)) or f . g means \x -> f (g (x)). Commented Jun 18, 2014 at 20:49
  • 3
    @MarjanVenema Things flow left in that example only because that's how . is defined; this isn't how Haskell works in general. You could just as well define F#'s forward pipe operator (|>) in Haskell and write smallest x = (sort x) |> head and the data would flow right. Just thought I'd point that out. Commented Jun 19, 2014 at 19:34