powerset2 ( allows strings subsets using vecsmall)

science_man_88 May 26th, 2017 (edited) 133 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. powerset2(s)=my(S=Vec(s),b=apply(r->Vec(r),S));for(x=2,#S,b=setbinop((x,y)->if(x!=Vec(y),concat(x,y),concat(x,[])),b,S));b=concat([[]],select(r->r==vecsort(r,,8),b));if(type(s)=="t_VECSMALL",b=apply(r->if(r!=[],r=Strchr(r),r=r),b));b
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand