total (p_product_list_item first, TOTAL_* target)
   -> (float64 result = 0)
{
  value_of (p_product item)         
  {
    select (target)
    {
      case TOTAL_PRICE:  return item->price;
      case TOTAL_WEIGHT: return item->weight;
    }
    else
    {
      error (ERR_PARAMETER);
    }
  }

  p_product_list_item current = first;

  while (current)
  {
    result += value_of (current->product); 
    current = current->next;
  }
}
