logoalt Hacker News

teddyhlast Monday at 10:18 AM2 repliesview on HN

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?


Replies

itishappylast Monday at 11:51 PM

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!

show 1 reply
Akronymuslast Monday at 5:52 PM

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

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

show 1 reply