Hacker News new | ask | show | jobs
by eliah-lakhin 4508 days ago
Yes, but newcomers don't know that. First thing they see is old school algol-like spaghetti. :) Haskell looks much nicer.
1 comments

what does this nicer non-spaghetti do?

chunkWith :: ([a] -> ([a], [a])) -> [a] -> [[a]]

chunkWith _ [] = []

chunkWith f xs = let (h, t) = f xs in h : chunkWith f t

i'm sure that many here merely glance at that and understand it immediately. but as i typed above, it somehow makes me feel bad about my own stupidity. (no need for anyone to explain specifically what this tiny example does, (i actually happen to understand this one). the goal here is to admire the immediate obviousness of the syntax ;))