Efficient list rotation

Joel Reymont joelr1@REDACTED
Fri Apr 15 11:32:40 CEST 2005

Hi Luke!

>The problem is to move the first element of the list to the end?
>Here's a simple way:
>  move_first_to_last([H|T]) -> T++[H].

I don't know in advance the position of the element that will be moving
to the end :-(. And I really need to "rotate" the list as opposed to
moving it to the end, yes, in a queue-like fashion :).

    Thanks, Joel


More information about the erlang-questions mailing list