MathGroup Archive 1996

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Subsets

  • To: mathgroup at smc.vnet.net
  • Subject: [mg5028] Re: Re: [mg4962] Subsets
  • From: Allan Hayes <hay at haystack>
  • Date: Sat, 19 Oct 1996 16:40:32 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

Eugene Lee has enquired about the extra entries used in Thread in =
the code mySubs2.

These are in case the list has some lists as members - they cause =
the threading to be over the first entry only. Here are two =
examples - I omit the error messages.

mySubs2[lis_List]:=3D
 	Fold[ Join[#1, Thread[Unevaluated[Append[#1,#2]], List,1]]&, =
{{}}, lis]
mySubs3[lis_List]:=3D
         Fold[Join[#1, Thread[Unevaluated[Append[#1,#2]]]]&, {{}}, =
lis]

lis1 =3D {{1,2},{3,4}};
lis2 =3D {{1,2},{3,4,5}};

mySubs3[lis1]
mySubs3[lis1]

mySubs2[lis1]
mySubs2[lis2]

Allan Hayes
hay at haystack.demon.co.uk
http://www.haystack.demon.co.uk





  • Prev by Date: Re: Simplification of (a^2)*Sqrt[a^(-2)]
  • Next by Date: Re: ts ts ts
  • Previous by thread: Re: Subsets
  • Next by thread: Re: Subsets