Darren New wrote:
> I thought it was pretty cool that the latest Erlang compilers will see
> code like
>
> map(F, [H|T]) -> [F(H)|map(F,T)];
> map(F, []) -> [].
>
> and turn it into the same code you'd get with an auxiliary accumulator
> and a call to "reverse" at the end.
Doesn't reverse require N operations? Wouldn't that mean that map now
takes 2N operations instead of just N?
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|