linked lists and a matter of terminology

Michael S. Zick mszick at morethan.org
Fri May 19 14:24:03 UTC 2006


On Fri May 19 2006 09:08, Robert P. J. Day wrote:
> 
>   and while we're on the subject of linked lists, can i make a
> suggestion to rename those function primitives?  i've never been happy
> with primitives like "add_to" and "add_to_end" since they're sort of
> vague and wishy-washy.  i think it would be far more meaningful to use
> "prepend" and "append", which have *independently* unambiguous
> meanings.
> 
>   (as an aside, i've always been thoroughly disgusted with perl's
> decision to name the four related operators "push", "pop", "shift" and
> "unshift".  what hideous and inconsistent choices.  grrrrrr ...)
> 
>   in any event, i think "prepend" and "append" are more
> clearly-defined since they obviously denote an underlying ordering.
> 
>   thoughts?
>

"prepend" and "append" imply a known order context.

That is, the location they refer too depends on if the list is
being used FIFO or FILO.

And if you are using the list to reverse the order become meaningless.

But I agree, the current names are ugly (no comment on the 2,000lb camel).

How about:
add_head, add_tail, rmv_head, rmv_tail?

Mike
> rday
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://busybox.net/cgi-bin/mailman/listinfo/busybox
> 
> 



More information about the busybox mailing list