chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] [PATCH] sequence type corrections and enhancements


From: Peter Bex
Subject: Re: [Chicken-hackers] [PATCH] sequence type corrections and enhancements
Date: Tue, 13 Sep 2011 21:28:10 +0200
User-agent: Mutt/1.4.2.3i

On Sun, Sep 11, 2011 at 12:26:45AM +0200, Felix wrote:
> Hello!
> 
> The attached patch implements a correction of the available sequence
> type specifiers. Currently "(list T)" and "(vector T)" designate lists
> or vectors with an unknown number of elements of the given type. This
> is suboptimal, because fixed-length lists/vectors (with possibly
> different element types) can not be handled by the flow analysis.

I'm trying to get some basic understanding of how the scrutinizer works,
but I can't get it to output the debugging info.
I run csc on a test program with -:D but that doesn't seem to trigger
the output (though AFAIK that should set fudge factor 13), and I also
used DEBUGBUILD=1 while building Chicken.

> So "(list T)" and "(vector T)" have been renamed to "(list-of T)" and
> "(vector-of T)" (which is compatible to the type-syntax of some other
> obscure Scheme implementation). "(list T ...)"/"(vector T ...)" now
> specify lists/vectors of fixed length with elements of the given
> types.

Here's an idea: Wouldn't it be useful to also have a way to encode the
length of the list, when it is known?  For example, when using MAP, if
you know the length of the input list you also know the length of the
output list.  Then later, when LENGTH is called, you can just return
the known length of that list instead of walking it.
The scrutinizer can also give a warning for other procedures that
require a list of at least n items when passed a list of a different
length.

I don't know if there are enough other such procedures to make this
really a big performance boost, though.

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth



reply via email to

[Prev in Thread] Current Thread [Next in Thread]