Changeset 3988


Ignore:
Timestamp:
Oct 22, 2008, 6:52:40 PM (12 years ago)
Author:
orlov
Message:
  • Merging for sorted lists has been rewritten with $iter.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/java/refal/refal/plus/List.rf

    r3987 r3988  
    181181
    182182$func Merge s.compare (e.left) (e.right) = e.merged_list;
    183 Merge s.compare (e.left) (e.right) = {
    184   e.left  : /*empty*/ = e.right;
    185   e.right : /*empty*/  = e.left;
    186   e.left : t.l e.left_rest, e.right : t.r e.right_rest = {
    187     <Apply s.compare (t.l) (t.r)> : '<' = t.l <Merge s.compare (e.left_rest) (e.right)>;
    188     t.r <Merge s.compare (e.left) (e.right_rest)>;
     183Merge s.compare (e.left) (e.right) =
     184  (e.left) (e.right) $iter {
     185    e.left : t.l e.left_rest, e.right : t.r e.right_rest = {
     186      <Apply s.compare (t.l) (t.r)> : '<' = (e.left_rest) (e.right) e.merged t.l;
     187      (e.left) (e.right_rest) e.merged t.r;
     188    };
     189  } :: (e.left) (e.right) e.merged,
     190  \{
     191    e.left  : /*empty*/ = e.merged e.right;
     192    e.right : /*empty*/ = e.merged e.left;
    189193  };
    190 };
    191194
    192195Sort e.list = <SortBy &Compare e.list>;
Note: See TracChangeset for help on using the changeset viewer.