PPP Exercises: Type operators and genericity


Exercise:

  1. Use a type operator to define a generic stack type 'GenStack'. The type operator takes the element type of the stack as parameter:
    Let GenStack(E <:Ok) <:Ok = ...
    
  2. Write a generic stack implementation for 'GenStack' as polymorphic function 'genStack' using 'list'.

  3. Use these definitions to define 'intStack :IntStack'.

  4. Summarize and compare the different definitions and implementations of stacks in the exercises Generic abstract data types and implementations, Currying, and in this exercise.

Ulrike Steffens, 1994