Changeset 2063


Ignore:
Timestamp:
Aug 24, 2006, 8:35:55 PM (14 years ago)
Author:
orlov
Message:
  • New functions Id and Append, and Map!.
  • Functions Map and Map! are $fail-able.
Location:
to-imperative/trunk/library/List/refal
Files:
2 edited

Legend:

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

    r2044 r2063  
    1414Paren-Term term = (term);
    1515
     16Id e1 = e1;
     17
     18Append (e1) e2 = e2 e1;
     19
    1620Zip (e.list1) (e.list2) =
    1721  (e.list1) (e.list2) /*empty*/ $iter {
     
    2731    e.list : t.item e.rest =
    2832      (e.new-list <Apply s.Fname e.Fargs t.item>) e.rest;
     33  } :: (e.new-list) e.list,
     34  e.list : /*empty*/ =
     35  e.new-list;
     36
     37Map! s.Fname e.Fargs (e.list) =
     38  () e.list $iter {
     39    e.list : (e.item) e.rest =
     40      (e.new-list (<Apply s.Fname e.Fargs e.item>)) e.rest;
    2941  } :: (e.new-list) e.list,
    3042  e.list : /*empty*/ =
     
    5567Elem? e.list t.item =
    5668  e.list : e t.item e;
    57 
    58 Get-Elem s.num (e.list) = <L s.num e.list>;
    5969
    6070Foldr s.Fname e.Fargs (e.value) (e.list) =
     
    113123 * Returns number of e.expr entries in e.source and e.source without all e.expr's.
    114124 */
    115 Entries e.expr (e.source) =
    116   0 e.source () $iter {
    117     e.source : e1 e.expr e2 = <"+" s.num 1> e2 (e.res e1);
    118     s.num (e.res e.source);
    119   } :: s.num e.source (e.res),
    120   e.source : /*empty*/ =
    121   s.num e.res;
     125//Entries e.expr (e.source) =
     126//  0 e.source () $iter {
     127//    e.source : e1 e.expr e2 = <"+" s.num 1> e2 (e.res e1);
     128//    s.num (e.res e.source);
     129//  } :: s.num e.source (e.res),
     130//  e.source : /*empty*/ =
     131//  s.num e.res;
    122132
    123133/*
  • to-imperative/trunk/library/List/refal/List.rfi

    r2037 r2063  
    33// $Date$
    44
     5$func Id e1 = e1;
     6
     7$func Append (e1) e2 = e2e1;
     8
    59$func Zip (e.list1) (e.list2) = e.new-list;
    610
    7 $func Map s.Fname e.Fargs (e.list) = e.new-list;
     11$func? Map s.Fname e.Fargs (e.list) = e.new-list;
     12
     13$func? Map! s.Fname e.Fargs (e.list) = e.new-list;
    814
    915$func Filter s.Fname e.Fargs (e.list) = e.new-list;
     
    1218
    1319$func? Elem? e.list t.item = ;
    14 
    15 $func Get-Elem s.num (e.list) = term;
    1620
    1721$func Foldr s.Fname e.Fargs (e.value) (e.list) = e.value;
     
    3236
    3337// Returns number of e.expr entries in e.source and e.source without all e.expr's.
    34 $func Entries e.expr (e.source) = s.num e.res;
     38// FIXME: Strange function!
     39// Additionally it conflicts with Table.Entries.
     40// Commented out at least until there is some sort of name conflicts resolution
     41// strategy.
     42// $func Entries e.expr (e.source) = s.num e.res;
    3543
    3644// Add to the first list all new elements from the second one.
Note: See TracChangeset for help on using the changeset viewer.