跳轉到內容

程式設計科學/SwayPresentations/物件/Examples2

來自華夏公益教科書,開放世界,開放書籍

例子

各個方面怎麼樣?

這是一個堆疊

   function stack()
       {
       var store = :null;
       
       function push(item)
           {
           store = cons(item,store);
           item;
           }
       function pop()
           {
           var item = car(store);
           store = cdr(store);
           item;
           }
       function empty?()
           {
           store == :null;
           }
       this;
       }
   

下一頁 上一頁 頂部

華夏公益教科書