Changeset 4006


Ignore:
Timestamp:
Oct 28, 2008, 8:03:12 PM (12 years ago)
Author:
yura
Message:
  • New Functions.
File:
1 edited

Legend:

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

    r4005 r4006  
    1111  } :: t.func e.arg, t.func : s.funcRef =
    1212  s.funcRef e.arg;
     13
     14$public $func TryFunc t.func e.res = e.res;
     15TryFunc t.func e.res = { <Apply t.func>; e.res; };
    1316
    1417$public $func? Apply t.func e.arg = e.res;
     
    4447  };
    4548
    46 $public $func Map t.func e.list = e.list;
     49$public $func? Map t.func e.list = e.list;
    4750Map t.func e.list =
    4851  () e.list $iter {
     
    5154  e.new_list;
    5255
    53 $func MapInHelp t.func t.term = t.term;
     56$func? MapInHelp t.func t.term = t.term;
    5457MapInHelp t.func (e.expr) = (<Apply t.func e.expr>);
    5558
    56 $public $func MapIn t.func e.list = e.list;
     59$public $func? MapIn t.func e.list = e.list;
    5760MapIn t.func e.list = <Map (&MapInHelp t.func) e.list>;
    5861
     
    7881  } :: (e.true_list) (e.false_list) e.list, e.list : /*empty*/ =
    7982  (e.true_list) (e.false_list);
     83
     84
     85$public $func Paren e.expr = t.expr_with_paren;
     86Paren e.expr = (e.expr);
     87
     88$public $func Zip (e.list1) (e.list2) = e.list;
     89Zip (e.list1) (e.list2) = <ZipWith &Paren (e.list1) (e.list2)>;
     90
     91$public $func? ZipWith t.func (e.list1) (e.list2) = e.list;
     92ZipWith t.func (e.list1) (e.list2) =
     93  /*empty*/ (e.list1) (e.list2) $iter {
     94    e.list1 : t.first1 e.rest1,
     95      e.list2 : t.first2 e.rest2 =
     96      e.new_list <Apply t.func t.first1 t.first2> (e.rest1) (e.rest2);
     97  } :: e.new_list (e.list1) (e.list2), # { e.list1 : v, e.list2 : v; } =
     98  e.new_list;
    8099
    81100$public $func? IsElem e.list t.item = ;
Note: See TracChangeset for help on using the changeset viewer.