diff --git a/doc/function/index.txt b/doc/function/index.txt index 693c1fb4..c4eef234 100644 --- a/doc/function/index.txt +++ b/doc/function/index.txt @@ -29,7 +29,8 @@ These functions are built into the program, other [[type:function]]s can be defi ! [[type:list|Lists]] <<< | [[fun:position]] Find the position of an element in a list. -| [[fun:number_of_items]] Find the number of items in a list. +| [[fun:length]] Return the number of items in a list. +| [[fun:number_of_items]] Return the number of items in a list. | [[fun:sort_list]] Sort a list. | [[fun:filter_list]] Filter a list, keeping only elements that match a predicate. diff --git a/doc/function/length.txt b/doc/function/length.txt new file mode 100644 index 00000000..7798007b --- /dev/null +++ b/doc/function/length.txt @@ -0,0 +1,22 @@ +Function: length + +--Usage-- +> length(some_collection) + +Returns the number of items in a list or the number of characters in a string. + +Note: This function is exactly the same as [[fun:number_of_items]]. + +--Parameters-- +! Parameter Type Description +| @input@ [[type:list]] or [[type:map]] or [[type:set]] or [[type:string]] + Object to determine the number of items of. + When it is a set, returns the number of cards. + When it is a string, returns the number of characters. + +--Examples-- +> length(["x", "y", "z"]) == 3 +> length("pink") == 4 + +--See also-- +| [[fun:number_of_items]] Return the number of items in a list. diff --git a/doc/function/number_of_items.txt b/doc/function/number_of_items.txt index 3c6014e7..727f4cd4 100644 --- a/doc/function/number_of_items.txt +++ b/doc/function/number_of_items.txt @@ -3,7 +3,9 @@ Function: number_of_items --Usage-- > number_of_items(in: some_collection) -Returns the position of an item in a list or characters in a string. +Returns the number of items in a list or the number of characters in a string. + +Note: This function is exactly the same as [[fun:length]]. --Parameters-- ! Parameter Type Description @@ -21,3 +23,8 @@ Returns the position of an item in a list or characters in a string. > > # the number of red cards in the set > number_of_items(in: set, filter: { card.color == "red" } ) + +--See also-- +| [[fun:length]] Return the number of items in a list. +| [[fun:sort_list]] Sort a list. +| [[fun:filter_list]] Filter a list, keeping only elements that match a predicate. diff --git a/doc/function/position.txt b/doc/function/position.txt index 70352c38..dae1aef0 100644 --- a/doc/function/position.txt +++ b/doc/function/position.txt @@ -24,3 +24,8 @@ If the item is not found in the list, returns @-1@. > > # The position of the card in the list of red cards, ordered by name > postion(of: card, in: set, order_by: {card.name}, filter:{card.color == "red"}) + +--See also-- +| [[fun:length]] / [[fun:number_of_items]] Return the number of items in a list. +| [[fun:sort_list]] Sort a list. +| [[fun:filter_list]] Filter a list, keeping only elements that match a predicate.