Re: Decent datastructure for queue operations
- From: "justinhj" <justinhj@xxxxxxxxx>
- Date: 31 Jan 2006 06:49:28 -0800
Edi Weitz wrote:
> On 31 Jan 2006 01:42:49 -0800, "meng" <meng234@xxxxxxxxx> wrote:
>
> > By the way, LISP has a function `last' which points directly to the
> > last item of a list without needing to traverse it.
>
> No, that's wrong. LAST has to traverse the list and is thus an O(n)
> operation.
>
> We recently had this discussion whether it's possible for an
> ANSI-compliant implementation to internally represent lists in a way
> that would make your behaviour possible. I forgot the outcome but in
> pratice it doesn't matter because all existing Common Lisps do it
> alike.
It seems to me if you want to know the length of the list and rapidly
access the last element you should use a vector instead.
Justin
.
- References:
- Decent datastructure for queue operations
- From: meng
- Re: Decent datastructure for queue operations
- From: mmcconnell17704
- Re: Decent datastructure for queue operations
- From: meng
- Re: Decent datastructure for queue operations
- From: Edi Weitz
- Decent datastructure for queue operations
- Prev by Date: Re: Static/Dynamic typing, lessons from the field
- Next by Date: Re: Static/Dynamic typing, lessons from the field
- Previous by thread: Re: Decent datastructure for queue operations
- Next by thread: Re: Decent datastructure for queue operations
- Index(es):
Relevant Pages
|