[erlang-questions] Rotating A List
Wed Dec 16 02:43:31 CET 2009
I did. The primary reason I didn't use it is because:
* I wanted to emphasize the functional nature of gen_server.
* I wanted to show how to use a raw list for this particular user.
* I wanted to show an example of using gen_server:reply/2.
* I wanted to have a simple example that showed the division between server implementation and API.
* It would have been slower. Note that the queue:drop/1 is O(1) amortized because of the way it handles list:reverse/1. Without using gen_server:reply/2 the way I did, the client could block on the reverse when it didn't really need to do so.
Queue would have been slightly easier, but it wouldn't have been nearly as instructive. :)
On Dec 15, 2009, at 5:24 PM, Chandru wrote:
> 2009/12/16 Jayson Vantuyl <>
> I recently did some attended SF Erlounge, which was quite a nice event. In addition to watching an excellent presentation on Erlang in the GitHub rebuild, I also fielded a few questions from some of the newer people. One of them had a pretty simple request:
> * manage a list
> * pull items off the front, but rotate them to the back
> Did you consider using the queue module in the gen_server? You seem to have reinvented the core of queue!
More information about the erlang-questions