1 ! Copyright (C) 2006 Chris Double.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: help.markup help.syntax ;
7 { car cons cdr nil nil? list? uncons } related-words
10 { $values { "car" "the head of the lazy list" } { "cdr" "the tail of the lazy list" } { "cons" "a cons object" } }
11 { $description "Constructs a cons cell." } ;
14 { $values { "cons" "a cons object" } { "car" "the first item in the list" } }
15 { $description "Returns the first item in the list." } ;
18 { $values { "cons" "a cons object" } { "cdr" "a cons object" } }
19 { $description "Returns the tail of the list." } ;
22 { $values { "cons" "An empty cons" } }
23 { $description "Returns a representation of an empty list" } ;
26 { $values { "cons" "a cons object" } { "?" "a boolean" } }
27 { $description "Return true if the cons object is the nil cons." } ;
29 HELP: list? ( object -- ? )
30 { $values { "object" "an object" } { "?" "a boolean" } }
31 { $description "Returns true if the object conforms to the list protocol." } ;
33 { 1list 2list 3list } related-words
36 { $values { "obj" "an object" } { "cons" "a cons object" } }
37 { $description "Create a list with 1 element." } ;
40 { $values { "a" "an object" } { "b" "an object" } { "cons" "a cons object" } }
41 { $description "Create a list with 2 elements." } ;
44 { $values { "a" "an object" } { "b" "an object" } { "c" "an object" } { "cons" "a cons object" } }
45 { $description "Create a list with 3 elements." } ;
48 { $values { "n" "an integer index" } { "list" "a cons object" } { "elt" "the element at the nth index" } }
49 { $description "Outputs the nth element of the list." }
50 { $see-also llength cons car cdr } ;
53 { $values { "list" "a cons object" } { "n" "a non-negative integer" } }
54 { $description "Outputs the length of the list. This should not be called on an infinite list." }
55 { $see-also lnth cons car cdr } ;
58 { $values { "cons" "a cons object" } { "car" "the head of the list" } { "cdr" "the tail of the list" } }
59 { $description "Put the head and tail of the list on the stack." } ;
62 { $values { "list" "a cons object" } { "quot" "a quotation with stack effect ( obj -- )" } }
63 { $description "Call the quotation for each item in the list." } ;
66 { $values { "list" "a cons object" } { "identity" "an object" } { "quot" "a quotation with stack effect ( prev elt -- next )" } { "result" "the final result" } }
67 { $description "Combines successive elements of the list using a binary operation, and outputs the final result." } ;