From: Al Chou Date: 2001-06-01T08:05:24+09:00 Subject: [ruby-talk:16101] Re: linked list redux --- Guillaume Cottenceau wrote: > [...] > > > (And I didn't find a way to insert an element in a Array) > > Ok, sorry for being so dumb, I can insert anything at given position by > doing: > > ary[pos, 0] = ... > > > (or ary[pos..pos-1] but it's not really nice looking) Thanks, all, Like Guillaume, I wasn't able to find a way to "insert" an element, which is (along with delete, whose implementation is built in to Array) the crux of what I wanted a linked list for -- not for performance reasons, but because I'm trying to make it easy to rearrange the order of the elements in the list. I was still sitting on the fence as to whether I should implement "insert" using dissection and recombining of Arrays or continue trying to fix my DoublyLinkedList class when I finally checked email again and found your solutions. I wonder if a user-contributed LinkedList subclass of Array would be of interest to anyone. Al ===== Albert Davidson Chou Get answers to Mac questions at http://www.mac-mgrs.org/ . __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/