s<-function(a)unique(Filter(function(x)sum(x)==10,unlist(Map(function(n)combn(a,n,sort,F),c(1:length(a))),F))) s(c(5,2,5,3))
Standard input is empty
[[1]] [1] 5 5 [[2]] [1] 2 3 5
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!