I'm going through "Pragmatic Programming Erlang" where there is a function defined like this:
split("\r\n\r\n" ++ T, L) -> {reverse(L), T};
split([H|T], L) -> split(T, [H|L]);
split([], _) -> more.
What interests me is first match, namely "\r\n\r\n" ++ T
- is there performance difference between such a pattern and similar one, that I came up with: [13,10,13,10|T]
? Or are they equivalent?
I know it's very simple question and that I could (probably) check it myself, but if there is a difference, I'd like to know why that is the case.
Thanks!
"\r\n\r\n" ++ T
is just syntax sugar for [13,10,13,10|T]
. It should perform same. If not there is something wrong ;-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With