[BACK]Return to list.texi CVS log [TXT][DIR] Up to [local] / OpenXM / src / asir-doc / parts / builtin

Diff for /OpenXM/src/asir-doc/parts/builtin/list.texi between version 1.1 and 1.2

version 1.1, 1999/12/08 05:47:44 version 1.2, 1999/12/21 02:47:33
Line 1 
Line 1 
   @comment $OpenXM$
   \BJP
 @node $B%j%9%H$N1i;;(B,,, $BAH$_9~$_H!?t(B  @node $B%j%9%H$N1i;;(B,,, $BAH$_9~$_H!?t(B
 @section $B%j%9%H$N1i;;(B  @section $B%j%9%H$N1i;;(B
   \E
   \BEG
   @node Lists,,, Built-in Function
   @section Lists
   \E
   
 @menu  @menu
 * car cdr cons append reverse length::  * car cdr cons append reverse length::
 @end menu  @end menu
   
 @node car cdr cons append reverse length,,, $B%j%9%H$N1i;;(B  \JP @node car cdr cons append reverse length,,, $B%j%9%H$N1i;;(B
   \EG @node car cdr cons append reverse length,,, Lists
 @subsection @code{car}, @code{cdr}, @code{cons}, @code{append}, @code{reverse}, @code{length}  @subsection @code{car}, @code{cdr}, @code{cons}, @code{append}, @code{reverse}, @code{length}
 @findex car  @findex car
 @findex cdr  @findex cdr
Line 16 
Line 24 
   
 @table @t  @table @t
 @item car(@var{list})  @item car(@var{list})
 :: $B6u$G$J$$(B @var{list} $B$N@hF,MWAG(B.  \JP :: $B6u$G$J$$(B @var{list} $B$N@hF,MWAG(B.
   \EG :: The first element of the given non-null list @var{list}.
 @item cdr(@var{list})  @item cdr(@var{list})
 :: $B6u$G$J$$(B @var{list} $B$+$i@hF,MWAG$r<h$j=|$$$?%j%9%H(B.  \JP :: $B6u$G$J$$(B @var{list} $B$+$i@hF,MWAG$r<h$j=|$$$?%j%9%H(B.
   \EG :: A list obtained by removing the first element of the given non-null list @var{list}.
 @item cons(@var{obj},@var{list})  @item cons(@var{obj},@var{list})
 :: @var{list} $B$N@hF,$K(B @var{obj} $B$rIU$12C$($?%j%9%H(B.  \JP :: @var{list} $B$N@hF,$K(B @var{obj} $B$rIU$12C$($?%j%9%H(B.
   \EG :: A list obtained by adding an element @var{obj} to the top of the given list @var{list}.
 @item @t{append}(@var{list1},@var{list2})  @item @t{append}(@var{list1},@var{list2})
 :: @var{list1} $B$H(B @var{list2} $B$r$3$N=g$K(B 1 $B$D$K$7$?%j%9%H(B.  \JP :: @var{list1} $B$H(B @var{list2} $B$r$3$N=g$K(B 1 $B$D$K$7$?%j%9%H(B.
   \EG :: A list obtained by adding all elements in the list @var{list2} according to the order as it is to the last element in the list @var{list1}.
 @item @t{reverse}(@var{list})  @item @t{reverse}(@var{list})
 :: @var{list} $B$r5U=g$K$7$?%j%9%H(B.  \JP :: @var{list} $B$r5U=g$K$7$?%j%9%H(B.
   \EG :: reversed list of @var{list}.
 @item length(@var{list})  @item length(@var{list})
 :: @var{list} $B$ND9$5(B.  \JP :: @var{list} $B$ND9$5(B.
   \EG :: Number of elements in a list @var{list}.
 @end table  @end table
   
 @table @var  @table @var
 @item return  @item return
 @code{car()} : $BG$0U(B, @code{cdr()}, @code{cons()}, @code{append()}, @code{reverse()} : $B%j%9%H(B,  @code{length()} : $B<+A3?t(B  \JP @code{car()} : $BG$0U(B, @code{cdr()}, @code{cons()}, @code{append()}, @code{reverse()} : $B%j%9%H(B,  @code{length()} : $B<+A3?t(B
   \EG @code{car()} : arbitrary, @code{cdr()}, @code{cons()}, @code{append()}, @code{reverse()} : list,  @code{length()} : non-negative integer
 @item list,list1,list2  @item list,list1,list2
 $B%j%9%H(B  \JP $B%j%9%H(B
   \EG list
 @item obj  @item obj
 $BG$0U(B  \JP $BG$0U(B
   \EG arbitrary
 @end table  @end table
   
 @itemize @bullet  @itemize @bullet
   \BJP
 @item  @item
 $B%j%9%H$O(B @t{[}@var{obj1},@var{obj2},...@t{]} $B$HI=$5$l$k(B. @var{obj1} $B$,(B  $B%j%9%H$O(B @t{[}@var{obj1},@var{obj2},...@t{]} $B$HI=$5$l$k(B. @var{obj1} $B$,(B
 $B@hF,MWAG$G$"$k(B.  $B@hF,MWAG$G$"$k(B.
Line 67 
Line 85 
 $BBh(B 1 $B0z?t$N%j%9%H$ND9$5$@$1$N(B @code{cons()} $B$N7+$jJV$7$H$J$k$?$a(B,  $BBh(B 1 $B0z?t$N%j%9%H$ND9$5$@$1$N(B @code{cons()} $B$N7+$jJV$7$H$J$k$?$a(B,
 $BBh(B 1 $B0z?t$N%j%9%H$,D9$$>l9g$K$OB?$/$N%a%b%j$r>CHq$9$k$3$H$K$J$k(B.  $BBh(B 1 $B0z?t$N%j%9%H$,D9$$>l9g$K$OB?$/$N%a%b%j$r>CHq$9$k$3$H$K$J$k(B.
 @code{reverse()} $B$K4X$7$F$bF1MM$G$"$k(B.  @code{reverse()} $B$K4X$7$F$bF1MM$G$"$k(B.
   \E
   \BEG
   @item
   A list is written in @b{Asir} as @t{[}@var{obj1},@var{obj2},@dots{}@t{]}.
   Here, @var{obj1} is the first element.
   @item
   Function @code{car()} outputs the first element of a non-null list.
   For a null list, the result should be undefined. In the current
   implementation, however, it outputs a null list.  This treatment for a
   null list may subject to change in future, and users are suggested not
   to use the tentative treatment for a null list for serious programming.
   @item
   Function @code{cdr()} outputs a list obtained by removing the first
   element from the input non-null list.
   For a null list, the result should be undefined. In the current
   implementation, however, it outputs a null list.  This treatment for a
   null list may subject to change in future, and users are suggested not
   to use the tentative treatment for a null list for serious programming.
   @item
   Function @code{cons()} composes a new list from the input list @var{list}
   and an arbitrary object @var{obj} by adding @var{obj} to the top of
   @var{list}.
   @item
   Function @code{append()} composes a new list, which has all elements of
   @var{list1} in the same ordering followed by all elements of @var{list2}
   in the same ordering.
   @item
   Function @code{reverse()} returns a reversed list of @var{list}.
   @item
   Function @code{length()} returns a non-negative integer which is the
   number of elements in the input list @var{list}.
   Note that function @code{size} should be used for counting elements
   of @var{vector} and @var{matrix}.
   @item
   Lists are read-only objects in @b{Asir}.  There elements cannot be
   modified.
   @item
   The @var{n}-th element in a list can be referred to by applying the
   function @code{cdr()} @var{n} times repeatedly and @code{cdr()} at last.
   A more convenient way to access to the @var{n}-th element is the use
   of bracket notation, that is, to attach an index @code{[@var{n}]}
   like vectors and matrices.  The system, however, follow the
   @var{n} pointers to access the desired element. Subsequently, much
   time is spent for an element located far from the top of the list.
   @item
   Function @code{cdr()} does not create a new cell (a memory quantity).
   Function @code{append()}, as a matter of fact, repeats @code{cons()}
   for as many as the length of @var{list1} the first argument.
   Subsequently, @code{append()} consumes much memory space if its
   first argument is long.
   Similar argument applies to function @code{reverse()}.
   \E
 @end itemize  @end itemize
   
 @example  @example

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>