r/programming • • May 08 '15

Five programming problems every Software Engineer should be able to solve in less than 1 hour

https://blog.svpino.com/2015/05/07/five-programming-problems-every-software-engineer-should-be-able-to-solve-in-less-than-1-hour
2.5k Upvotes

2.1k comments sorted by

View all comments

Show parent comments

26

u/[deleted] May 08 '15

As someone who hasn't used haskell before... Are for loops even supposed to be used in Haskell? It looks so alien to me.

38

u/eagle23 May 08 '15

You are right, they aren't. Haskell is (for the most part, there are exceptions) purely functional and all data structures immutable and thus no point in conventional for loops. Instead Haskell users employ folds, maps and recursive functions. /u/spacelibby wrote a recursive function to emulate a for loop so as to try and hack one in.

1

u/Isvara May 08 '15

What are the exceptions?