ada泛型list示例代码

代码语言:ada

所属分类:其他

代码描述:ada泛型list示例代码

代码标签: 示例

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

package body Gen_List is

   function Append ( E1 : Elmt) return List is 
   begin 
      return new Internal'(E1, Nil);
   end Append;
   
   function Append ( E1, E2 : Elmt) return List is
   begin
      return new Internal'(E1, new Internal'(E2, Nil));
   end Append;
   
   function Append ( E1 : Elmt; L1 : List) return List is 
   begin
      return new Internal'(E1, L1);
   end Append;
   
   function Append ( L1 : List; E1 : Elmt) return List is
      L : List;
   begin
      if L1 = Nil then 
         return new Internal'(E1, Nil);
      else
         L := L1;
         while L.Next /= Nil loop
            L := L.Next;
         end loop;
         L.Next := new Internal'(E1, Nil);
         return L1;
      end if;
   end Append;
 
   function Append ( L1, L2 : List) return List is
      L : List;
   begin
      if L1 = Nil then 
         return L2;
      else
         L := L1;
         while.........完整代码请登录后点击上方下载按钮下载查看

网友评论0