The Science of Programming/SwayPresentations/Objects/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;
           }
       }