跳转到内容

程序设计科学/SwayPresentations/对象/right

来自维基教科书,面向开放世界的开放书籍
   function right(items)
       {
       var slots = items . constructor . parameters;
       var lhs = slots[0];
       var rhs = slots[1];
       if (type(items . (lhs)) == :OBJECT
       && items . constructor == items . (lhs) . constructor)
           {
           var x = items . (lhs);
           items . (lhs) = x . (rhs);
           x . (rhs) = items;
           right(x);
           }
       else
           {
           items;
           }
       }
华夏公益教科书