Hi, I would do it something like this: solve(Count) :- Array = [](40,6,31,84,4), ( fromto(0,This,Next,Count), foreachelem(Elem,Array) do (Elem > 10 -> Next is This +1; Next = This) ). Best regards, Philipp On 12.05.2010 11:26, peter barkly wrote: > Hello, > > I am new to Eclipse. > > How do I count elements of a list/array that satisfy a particular > condition? > > For example, I want to count the number of elements in a list that are > larger than 10. > > solve(Count):- > dim(Array, [5]), > for(I, 1, 5) do > ( > % get value of Count here > ). > > > > ------------------------------------------------------------------------------ > > > > > _______________________________________________ > ECLiPSe-CLP-Users mailing list > ECLiPSe-CLP-Users_at_lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users >Received on Fri May 14 2010 - 07:49:12 CEST
This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST