home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / language / isetl / defins.t < prev    next >
Text File  |  1987-08-20  |  387b  |  20 lines

  1.    insert := func(f,id);
  2.         return func(S); local i,part;
  3.                 part := id;
  4.                 for i in S do
  5.                 part := f(part,i);
  6.                 end;
  7.                 return part;
  8.                end;
  9.          end;
  10.  
  11.    sum := insert( func(a,b); return a+b; end, 0 );
  12.    prod := insert( func(a,b); return a*b; end, 1 );
  13.    fact := func(N); return prod([1..N]); end;
  14.  
  15. sum([1..10]);
  16. sum([10,11,12]);
  17. fact(3);
  18. fact(4);
  19. fact(10);
  20.