[plt-scheme] PLT4 expectations
At Tue, 11 Mar 2008 21:24:55 +0100, "Jos Koot" wrote:
> If I understand this well, it is still worthwhile to use pair? in stead of
> list? in case you are sure that the object is either a list or not a pair at
> all.
Yes, the constant on a `pair?' test can be significantly smaller than
the cost on a `list?' test.
Matthew
> For a moment I thought I could ,with the same costs, use list? in stead of
> pair? where I in fact I do mean list?
> Jos
>
> ----- Original Message -----
> From: "Matthew Flatt" <mflatt at cs.utah.edu>
> To: "Doug Orleans" <dougorleans at gmail.com>
> Cc: "PLT-Scheme Mailing List" <plt-scheme at list.cs.brown.edu>
> Sent: Tuesday, March 11, 2008 1:14 PM
> Subject: Re: [plt-scheme] PLT4 expectations
>
>
> > At Tue, 11 Mar 2008 01:01:08 -0400, Doug Orleans wrote:
> >> Matthew Flatt writes:
> >> > At Mon, 10 Mar 2008 14:34:49 +0000, "Paulo J. Matos" wrote:
> >> > > The idea of PLT4 creating by default immutable pairs and the so,
> >> means
> >> > > that it also opens the possibility for far more and better
> >> > > optimizations in the compiler, right?
> >> >
> >> > I doubt that there are many new optimization opportunities that matter
> >> > in practice.
> >>
> >> Well, you could make "list?" be O(1) instead of O(n), at a cost of one
> >> bit per cons cell.
> >
> > Yes, `list?' is currently amortized constant time.
> >
> > To avoid making `cons' more expensive, no bit is actually set until you
> > start using `list?' (which is why the cost has to be amortized to call
> > it constant time).
> >
> > Matthew
> >
> > _________________________________________________
> > For list-related administrative tasks:
> > http://list.cs.brown.edu/mailman/listinfo/plt-scheme