Author: aschnell Date: Fri Jun 20 17:12:25 2008 New Revision: 48462 URL: http://svn.opensuse.org/viewcvs/yast?rev=48462&view=rev Log: - documentation for list::reduce Modified: trunk/core/libycp/src/YCPBuiltinList.cc Modified: trunk/core/libycp/src/YCPBuiltinList.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libycp/src/YCPBuiltinList.cc... ============================================================================== --- trunk/core/libycp/src/YCPBuiltinList.cc (original) +++ trunk/core/libycp/src/YCPBuiltinList.cc Fri Jun 20 17:12:25 2008 @@ -1092,12 +1092,17 @@ * @param flex1 x * @param flex1 y * @param list<flex1> list - * @param block<flex1> expr + * @param block<flex1> expression * @return flex1 * - * TODO + * @description + * Apply expression cumulatively to the values of the list, from left to + * right, to reduce the list to a single value. See + * http://en.wikipedia.org/wiki/Reduce_(higher-order_function) for a + * detailed explanation. * - * list must not be empty + * In this version the initial value is the first value of the list. Thus + * the list must not be empty. * * @usage list::reduce (integer x, integer y, [2, 4, 6], { return x < y ? x : y; }) -> 2 * @usage list::reduce (integer x, integer y, [2, 4, 6], { return x < y ? x : y; }) -> 6 @@ -1158,18 +1163,22 @@ * @param flex2 y * @param flex1 value * @param list<flex2> list - * @param block<flex1> expr + * @param block<flex1> expression * @return flex1 - * - * TODO - * - * list can be empty + * + * @description + * Apply expression cumulatively to the values of the list, from left to + * right, to reduce the list to a single value. See + * http://en.wikipedia.org/wiki/Reduce_(higher-order_function) for a + * detailed explanation. + * + * In this version the initial value is explicitly provided. Thus the list + * can be empty. Also the return type can be different from the type of + * the list. * * @usage list::reduce (integer x, integer y, 0, [2, 4, 6], { return x + y; }) -> 12 * @usage list::reduce (integer x, integer y, 1, [2, 4, 6], { return x * y; }) -> 48 * - * different types - * * @usage list::reduce (term t, float f, `item(`id(`dummy)), [3.14, 2.71], { return add(t, tostring(f)); }) -> `item (`id (`dummy), "3.14", "2.71") */ -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org