Changeset 3989 for to-imperative


Ignore:
Timestamp:
Oct 22, 2008, 8:40:24 PM (12 years ago)
Author:
orlov
Message:
Location:
to-imperative/trunk/java/refal/refal/plus
Files:
2 edited

Legend:

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

    r3988 r3989  
    1515
    1616Append (e1) e2 = e2 e1;
     17
     18EqTerms t1 t1;
     19
     20CompareTerms t1 t2 = <Compare (t1) (t2)>;
    1721
    1822Zip (e.list1) (e.list2) =
     
    134138  e.ll;
    135139
    136 Nub e.expr =
     140Nub e.expr = <NubBy &EqTerms e.expr>;
     141
     142NubBy s.eq e.expr =
    137143  e.expr () $iter {
    138144    e.expr : term e.rest, {
    139       e.selected : e term e = e.rest (e.selected);
    140       e.rest (e.selected term);
     145      <Any s.eq (term) (e.selected)> = e.rest (e.selected);
     146      e.rest (e.selected (term));
    141147    };
    142148  } :: e.expr (e.selected),
    143149  e.expr : /*empty*/ =
    144   e.selected;
     150  <Concat e.selected>;
    145151
    146152Replicate s.n e.expr =
     
    193199  };
    194200
    195 Sort e.list = <SortBy &Compare e.list>;
     201Sort e.list = <SortBy &CompareTerms e.list>;
    196202
    197203/*
  • to-imperative/trunk/java/refal/refal/plus/List.rfi

    r3987 r3989  
    44
    55$func Id e.expr = e.expr;
     6
     7$func? EqTerms t1 t2 = ;
     8
     9$func CompareTerms t1 t2 = s.Lt_or_Eq_or_Gt;
    610
    711$func Append (e.expr1) e.expr2 = e.expr2expr1;
     
    4145$func Nub e.list = e.list;
    4246
     47$func NubBy s.eq e.list = e.list;
     48
    4349$func Replicate s.n e.expr = e.list;
    4450
Note: See TracChangeset for help on using the changeset viewer.