Position of arguments in function definition and performance
José Romildo Malaquias
romildo@uber.com.br
Wed, 6 Feb 2002 19:32:15 -0200
Hello.
Please, tell me which set of definitions below should I expected
to be more efficient: the reverse1 or the reverse2 functions.
reverse1 [] ys = ys
reverse1 (x:xs) ys = reverse2 (x:ys) xs
reverse2 ys [] = ys
reverse2 ys (x:xs) = reverse2 (x:ys) xs
The difference rely on the position of the argument in which the
pattern matching is done in the function definition.
Regards.
Romildo
--
Prof. José Romildo Malaquias Departamento de Computação
http://iceb.ufop.br/~romildo Universidade Federal de Ouro Preto
romildo@iceb.ufop.br Brasil
romildo@uber.com.br