note description: "[ Summation over a collection according to an integer expression ]" author: "" date: "$Date$" revision: "$Revision$" expanded class interface NUMERIC_ITERABLE [G -> attached ANY] create default_create feature sumf (a_collection: ITERABLE [G]; f: FUNCTION [G, INTEGER_32]): INTEGER_32 -- sum a_collection according to function f[g] ∈ INT ensure class note usage: "[ fcount(s: STRING): INTEGER do Result := s.count end t1: BOOLEAN -- (Σs ∈ <<"abb", "bnmm">>: s.count) = 7 local sigma: NUMERIC_ITERABLE[STRING] do comment("t1: test sumf") Result := sigma.sumf (<<"abb", "bnmm">>, agent fcount) = 7 end ]" end -- class NUMERIC_ITERABLE
Generated by ISE EiffelStudio