Remix.run Logo
teddyh a day ago

It’s been said that structured programming is programming without GOTO, and functional programming is programming without assignment statements. Is declarative programming then programming without the concept of linear time?

itishappy 10 hours ago | parent | next [-]

I would argue that imperative programming is the only one with a concept of linear time.

Here's a functional example:

    map (*3) [0,1,2,3,4,5,6,7,8,9]
Are those multiplications run in sequence or parallel?

Here's a fancier functional one:

    getUser = User <$> getName <*> getEmail <*> getStartDate
What order are the fields fetched?

If you answered "unspecified" then you're right! A compiler could parallelize either of these expressions!

Akronymus 16 hours ago | parent | prev [-]

I thought fp was more avoiding mutability/reassigning values to identifiers

What you wrote makes me think more of the point free style

rhsjie294nd 2 hours ago | parent [-]

When hearing of assignment statements, I think of mutability. Point free makes me think of (low to) no variables, rather than no assignments