2008-06-03 04:04:20 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								! Copyright (C) 2006 Chris Double. 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								! See http://factorcode.org/license.txt for BSD license. 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-09 15:29:09 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								USING:  kernel  help.markup  help.syntax  arrays  sequences  math  quotations  ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-06-03 04:04:20 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								IN:  lists 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-09 15:29:09 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								ABOUT: "lists" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								ARTICLE: "lists"  "Lists" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								"The "  { $vocab-link "lists"  } " vocabulary implements linked lists. There are simple strict linked lists, but a generic list protocol allows the implementation of lazy lists as well." 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $subsections
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { "lists"  "protocol"  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { "lists"  "strict"  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { "lists"  "manipulation"  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    { "lists"  "combinators"  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}
							 
						 
					
						
							
								
									
										
										
										
											2009-02-09 15:29:09 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $vocab-subsection "Lazy lists"  "lists.lazy"  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								ARTICLE: { "lists"  "protocol"  } "The list protocol" 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-16 14:34:39 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								"Lists are instances of a mixin class:" 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $subsections list }
							 
						 
					
						
							
								
									
										
										
										
											2009-02-09 15:29:09 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								"Instances of the mixin must implement the following words:" 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $subsections
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    car
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    cdr
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    nil?
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ;
 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-09 15:29:09 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-03-04 16:04:55 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								ARTICLE: { "lists"  "strict"  } "Constructing strict lists" 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-09 15:29:09 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								"Strict lists are simply cons cells where the car and cdr have already been evaluated. These are the lists of Lisp. To construct a strict list, the following words are provided:" 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $subsections
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    cons
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    swons
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    sequence>list
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    1list
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    2list
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    3list
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ;
 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-09 15:29:09 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								ARTICLE: { "lists"  "combinators"  } "Combinators for lists" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								"Several combinators exist for list traversal." 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $subsections
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    leach
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    lmap
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    foldl
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    foldr
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    lmap>array
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ;
 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-09 15:29:09 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								ARTICLE: { "lists"  "manipulation"  } "Manipulating lists" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								"To get at the contents of a list:" 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $subsections
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    uncons
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    unswons
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    lnth
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    cadr
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    llength
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}
							 
						 
					
						
							
								
									
										
										
										
											2009-02-09 15:29:09 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								"To get a new list from an old one:" 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $subsections
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    lreverse
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    lappend
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    lcut
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-06-03 04:04:20 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  cons  
							 
						 
					
						
							
								
									
										
										
										
											2009-05-16 01:29:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "car"  "the head of the list cell"  } { "cdr"  "the tail of the list cell"  } { "cons"  list } }
							 
						 
					
						
							
								
									
										
										
										
											2009-02-09 15:29:09 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $description "Constructs a cons cell."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  swons  
							 
						 
					
						
							
								
									
										
										
										
											2009-05-16 01:29:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "cdr"  "the tail of the list cell"  } { "car"  "the head of the list cell"  } { "cons"  list } }
							 
						 
					
						
							
								
									
										
										
										
											2008-06-03 04:04:20 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Constructs a cons cell."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-09 15:29:09 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ cons swons uncons unswons } related-words
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-06-03 04:04:20 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								HELP:  car 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-16 01:29:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "cons"  list } { "car"  "the first item in the list"  } }
							 
						 
					
						
							
								
									
										
										
										
											2008-06-03 04:04:20 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Returns the first item in the list."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  cdr 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-16 01:29:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "cons"  list } { "cdr"  list } }
							 
						 
					
						
							
								
									
										
										
										
											2008-06-03 04:04:20 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Returns the tail of the list."  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-09 15:29:09 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ car cdr } related-words
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-06-03 04:04:20 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								HELP:  nil  
							 
						 
					
						
							
								
									
										
										
										
											2008-06-05 18:53:58 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $values { "symbol"  "The empty cons (+nil+)"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Returns a symbol representing the empty list"  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-06-03 04:04:20 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  nil?  
							 
						 
					
						
							
								
									
										
										
										
											2008-08-30 11:15:09 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $values { "object"  object  } { "?"  "a boolean"  } }
							 
						 
					
						
							
								
									
										
										
										
											2008-06-03 04:04:20 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Return true if the cons object is the nil cons."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-09 15:29:09 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ nil nil? } related-words
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-06-03 04:04:20 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 1list 2list 3list } related-words
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  1list 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-16 01:29:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "obj"  "an object"  } { "cons"  list } }
							 
						 
					
						
							
								
									
										
										
										
											2008-06-03 04:04:20 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Create a list with 1 element."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  2list 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-16 01:29:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "a"  "an object"  } { "b"  "an object"  } { "cons"  list } }
							 
						 
					
						
							
								
									
										
										
										
											2008-06-03 04:04:20 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Create a list with 2 elements."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  3list 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-16 01:29:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "a"  "an object"  } { "b"  "an object"  } { "c"  "an object"  } { "cons"  list } }
							 
						 
					
						
							
								
									
										
										
										
											2008-06-03 16:28:02 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Create a list with 3 elements."  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-09 15:29:09 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-06-03 16:28:02 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								HELP:  lnth 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-16 01:29:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "n"  "an integer index"  } { "list"  list } { "elt"  "the element at the nth index"  } }
							 
						 
					
						
							
								
									
										
										
										
											2008-06-03 16:28:02 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Outputs the nth element of the list."  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $see-also llength cons car cdr } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  llength 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-16 01:29:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "list"  list } { "n"  "a non-negative integer"  } }
							 
						 
					
						
							
								
									
										
										
										
											2008-06-03 16:28:02 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Outputs the length of the list. This should not be called on an infinite list."  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $see-also lnth cons car cdr } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  uncons 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-16 01:29:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "cons"  list } { "car"  "the head of the list"  } { "cdr"  "the tail of the list"  } }
							 
						 
					
						
							
								
									
										
										
										
											2009-02-09 15:29:09 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $description "Put the head and tail of the list on the stack."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  unswons 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 18:40:43 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "cons"  list } { "cdr"  "the tail of the list"  } { "car"  "the head of the list"  } }
							 
						 
					
						
							
								
									
										
										
										
											2008-06-03 16:28:02 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Put the head and tail of the list on the stack."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-06-05 04:13:51 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ leach foldl lmap>array } related-words
							 
						 
					
						
							
								
									
										
										
										
											2008-06-03 16:31:38 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  leach 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-10 00:02:43 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "list"  list } { "quot"  { $quotation "( ... elt -- ... )"  } } }
							 
						 
					
						
							
								
									
										
										
										
											2008-06-03 16:31:38 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Call the quotation for each item in the list."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-06-05 04:13:51 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								HELP:  foldl 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-10 00:02:43 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "list"  list } { "identity"  "an object"  } { "quot"  { $quotation "( ... prev elt -- ... next )"  } } { "result"  "the final result"  } }
							 
						 
					
						
							
								
									
										
										
										
											2008-06-05 04:13:51 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Combines successive elements of the list (in a left-assocative order) using a binary operation and outputs the final result."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  foldr 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-10 00:02:43 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "list"  list } { "identity"  "an object"  } { "quot"  { $quotation "( ... prev elt -- ... next )"  } } { "result"  "the final result"  } }
							 
						 
					
						
							
								
									
										
										
										
											2008-06-05 04:13:51 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Combines successive elements of the list (in a right-assocative order) using a binary operation, and outputs the final result."  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-06-03 16:31:38 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-06-05 04:13:51 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								HELP:  lmap 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-10 00:02:43 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "list"  list } { "quot"  { $quotation "( ... elt -- ... newelt )"  } } { "result"  "the final result"  } }
							 
						 
					
						
							
								
									
										
										
										
											2008-06-05 04:13:51 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Applies the quotation to each element of the list in order, collecting the new elements into a new list."  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-09 15:29:09 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-06-05 04:13:51 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								HELP:  lreverse 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-09 15:29:09 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "list"  list } { "newlist"  list } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Reverses the input list, outputing a new, reversed list. The output is a strict cons list."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  list>array     
							 
						 
					
						
							
								
									
										
										
										
											2009-05-16 01:29:21 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ $values { "list"  list } { "array"  array  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Convert a list into an array."  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-09 15:29:09 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  list 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $class-description "The class of lists. All lists are expected to conform to "  { $link { "lists"  "protocol"  } } "."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  cadr 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $values { "list"  list } { "elt"  object  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Returns the second element of the list, ie the car of the cdr."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  lappend 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $values { "list1"  list } { "list2"  list } { "newlist"  list } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Appends the two lists to form a new list. The first list must be finite. The result is a strict cons cell, and the first list is exausted."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  lcut 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $values { "list"  list } { "index"  integer  } { "before"  cons } { "after"  cons } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Analogous to "  { $link cut  } ", this word cuts a list into two pieces at the given index."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								HELP:  lmap>array 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $values { "list"  list } { "quot"  quotation } { "array"  array  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ $description "Executes the quotation on each element of the list, collecting the results in an array."  } ;