Hacker News new | ask | show | jobs
by anaphor 2472 days ago
I don't think you should judge it based on the syntax. With UFCS (Uniform Function Call Syntax), or a pipeline operator, it could easily be rewritten to something like:

xs.map(\x -> (div (n - length x) 2).replicate(' ') ++ x)

This is just pseudocode obviously, but you get the point I hope. There is nothing fundamental to FP about this particular syntax.

Also to be honest, I don't find the original unreadable at all. But that may be because I have more exposure to this style of programming? FP doesn't somehow remove the inherent complexity in tasks like string manipulation.