Hacker News new | ask | show | jobs
by quchen 4607 days ago
Yes.

  oneTwo = 1 : 2 : oneTwo
is a circular singly-linked list containing 1 and 2. If you wanted to change the 1 to a 4 though, you would not be able to do so without creating an entire new list. You can use Vector or Array (i.e. fixed-size containers) to make yourself a circular buffer, but the implementation will be very similar to what you would do in C.
1 comments

Wow. That looks hard. I bet you stayed up all night working on that. ;-)

Seriously: sometimes things are hard because you don't know the language all that well. Consider that possibility.

Just to be clear: the advice of "consider that possibility" is intended for the author of the article. quchen clearly knows the "easy" way to do this kind of thing with Haskell.