[PRL] Accumulator for container capacity
Matthias Felleisen
matthias at ccs.neu.edu
Fri Sep 30 16:40:26 EDT 2005
On Sep 30, 2005, at 11:58 AM, Felix S Klock II wrote:
> Karl-
>
> On Sep 30, 2005, at 11:41 AM, Karl Lieberherr wrote:
>
>> Adaptive Programming (AP) takes the principle of Structural Recursion
>> (SR)
>> to a new level. In SR you organize your program following the
>> structure of
>> your data. SR is an old principle and has recently been promoted
>> systematically in HtDP. AP applies SR to focusing on the difference
>> between
>> the structural recursion template and the desired program. The
>> information
>> in the structural recursion template (that is systematically defined
>> by the
>> data type definition), is not repeated in the adaptive program.
>>
>
> What does AP give you that Polytypic programming does not?
>
> Polytypic programming does not repeat the information from the
> template.
>
> In fact, in a sense polytypic programs are parameterized over the
> template. (More precisely, polytypic programs are parameterized over
> the client's choice of type-constructor; the template is then derived
> from the structure of the type constructor to yield a particular
> instantiation of a polytypic program.)
Amen. If you look in HtDP IV, you will see a discussion of how to
abstract the SR template. I don't ever teach this. But it comes from
work in EoPL courses where I pushed students to develop a fully lazy
abstraction because it's the only fully general way to get this right.
-- Matthias
> My memory is poor; I can imagine potential additions provided by AP
> (e.g. the ability to inspect the name given to a class, which
> polytypic programs in their purely structural form do not allow), but
> I am not familiar enough with AP technology to be certain of what it
> provides. I just want to understand the reasons that one would select
> AP over PolyP.
More information about the PRL
mailing list