Ignore:
Timestamp:
Oct 24, 2008, 2:21:05 PM (12 years ago)
Author:
yura
Message:
  • Rewritten.
File:
1 edited

Legend:

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

    r3994 r3995  
    117117  e.ll;
    118118
     119$func Paren_Term term = (term);
     120Paren_Term term = (term);
     121
     122$func ConcatHelp t.term = e.expr;
     123ConcatHelp {
     124  (e.expr) = e.expr;
     125  t.term   = t.term;
     126};
     127
     128$public $func Concat e.lists = e.list;
     129Concat e.lists = <Map &ConcatHelp e.lists>;
     130
    119131//Nub e.expr = <NubBy &EqTerms e.expr>;
    120132//
     
    138150//
    139151//
    140 //$func QSort_Split t.num e.list = (e.list) (e.list);
    141 //
    142 //QSort_Split t.num e.list,
    143 //  () () (e.list) $iter {
    144 //    e.list : t.head e.tail, {
    145 //      <Le (t.head) (t.num)>,
    146 //        (e.smaller t.head) (e.greater) (e.tail);
    147 //      (e.smaller) (e.greater t.head) (e.tail);
    148 //    };
    149 //  } :: (e.smaller) (e.greater) (e.list),
    150 //  e.list : /*empty*/,
    151 //  (e.smaller) (e.greater);
    152 //
    153 //QSort {
    154 //  /* empty */   = /* empty */;
    155 //  t.head e.tail = <QSort_Split t.head e.tail> :: (e.smaller) (e.greater),
    156 //    <QSort e.smaller> t.head <QSort e.greater>;
    157 //};
    158 //
     152
     153$func QSort_Split t.num e.list = (e.list) (e.list);
     154QSort_Split t.num e.list,
     155  () () (e.list) $iter {
     156    e.list : t.head e.tail, {
     157      <Le (t.head) (t.num)>,
     158        (e.smaller t.head) (e.greater) (e.tail);
     159      (e.smaller) (e.greater t.head) (e.tail);
     160    };
     161  } :: (e.smaller) (e.greater) (e.list),
     162  e.list : /*empty*/,
     163  (e.smaller) (e.greater);
     164
     165$public $func QSort e.list = e.list;
     166QSort {
     167  /* empty */   = /* empty */;
     168  t.head e.tail = <QSort_Split t.head e.tail> :: (e.smaller) (e.greater),
     169    <QSort e.smaller> t.head <QSort e.greater>;
     170};
     171
    159172//SortBy s.cmpTerms e.list =
    160173//  <Length e.list> :: s.len,
Note: See TracChangeset for help on using the changeset viewer.