Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Right. Is that because functional languages prefer immutable data structures?

e.g. cdr/ tail / list.skip(1) are easier and simpler if you can just return the first element's next pointer rather than copying an array.



Yes, that's the idea. ArrayLists don't work well at all if you want persistent data structures as your language's default. Also arrays are less sensible for pattern-matching. (Note that most functional languages offer normal stateful arrays as an option, if they're necessary; interestingly, Erlang does not.)




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

Search: