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

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



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

;;

if c t f = case c of True -> t; False -> f end;

loses l = case l of Nil -> 0; Cons x xs -> 1 + loses xs end;

gains x = letrec loop=loop in loop;

rep n x = if (n <= 0) Nil (Cons x (rep (n-1) x));

length = loses;

append l1 l2 = case l1 of Nil -> l2; Cons x xs -> Cons x (append xs l2) end;

gainAndLose as bs 
   = letrec loop=loop in append as (rep (length bs) loop);


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.