Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/tests/nofib/real/anna/ap_Zip.cor

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.



list a ::= Nil | Cons a (list a);

tp2 a b ::= Mk2 a b;

tp3 a b c ::= Mk3 a b c;

tp4 a b c d ::= Mk4 a b c d;

;;

error = error;

zip la lb
 = case la of
      Nil -> case lb of
                Nil -> Nil;
                Cons b bs -> error
             end;
      Cons a as -> case lb of
                      Nil -> error;
                      Cons b bs -> Cons (Mk2 a b) (zip as bs)
                   end
   end;

zip2 la lb
  = case la of Nil -> Nil; Cons a as ->
    case lb of Nil -> Nil; Cons b bs ->
      Cons (Mk2 a b) (zip2 as bs)
    end
    end;

zip3 la lb lc
  = case la of Nil -> Nil; Cons a as ->
    case lb of Nil -> Nil; Cons b bs ->
    case lc of Nil -> Nil; Cons c cs ->
      Cons (Mk3 a b c) (zip3 as bs cs)
    end 
    end
    end;

zip4 la lb lc ld
  = case la of Nil -> Nil; Cons a as ->
    case lb of Nil -> Nil; Cons b bs ->
    case lc of Nil -> Nil; Cons c cs ->
    case ld of Nil -> Nil; Cons d ds ->
      Cons (Mk4 a b c d) (zip4 as bs cs ds)
    end 
    end
    end
    end;

{
                            Arg  Result  Group  Total   Func   Case       Anna    Norm   Norm
   Name               Rec Points Points    Max  Nodes  Nodes  Nodes       Cost      ap     rp
------------------------------------------------------------------------------------------------

   _zip2              yes     16      7      5     21      1      2     251588  5671.3  306.2
   _zip3              yes     64     11      6     29      1      3    1726793  6487.6  177.82
   _zip4              yes    256     19      7     37      1      4   13445545  9471.6  114.35
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.