Hacker News new | past | comments | ask | show | jobs | submit login

>Imagine we want a range function where range(5) returns [1,2,3,4,5].

The imperative solution makes perfect sense and is fast, everyone can understand it including future me. I don't have to think about it at all and just understand it as I'm reading it.

In the real world out there this is something that carries a lot of value.




> everyone can understand it

The recurrence relation of range(n)=range(n-1):n is easily understood and also already the naive functional implementation.

These kinds of recursive/recurrence definitions are part of K12 curriculae, and not just at the end of it.

Functional programming is not inherently harder to understand than imperative programming. Your school blackboard has been functional and stateless since grade 1. At some point somebody tacked state on to your mental model, and somehow I=I+1 now makes sense.

To me it looks like a purely educational problem, when FP is dismissed for not being easily understood, compared to the IP abstractions.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: