Posts

Showing posts with the label intentional programming

Erlang - Why so many (seemingly identical) tools?

Image
Ever wondered why many of the erlang modules provide seemingly similar functionality (" functionality". ho ho ho ) using different functions? Why there are so many tools that seemingly do pretty much the same thing? Consider that you could just use lists :map / 2 instead of lists :foreach / 2 , and ignore the result if all you cared about were side-effects.  e.g. lists:foreach(fun(X) -> do_something_to_a_file_named_(X) end, [a,b,c]) could just as easily be done as _Ignore = lists:map(fun(X) -> do_something_to_a_file_named_(X) end, [a,b,c]) Yeah, yeah. I know. Its stupid.  But you could do it, no?  Come to think of it, I'd bet that any number of people are actually doing it even as we speak - given that its not actually wrong , y'know?  It doesn't stop there - consider the following in the lists module     ⁃    lists : sum / 1 could just as easily be done using just a wee bit more code using lists :foldl / 3  ...