Re: Lists and Recursion
- To: mathgroup at smc.vnet.net
- Subject: [mg9470] Re: [mg9444] Lists and Recursion
- From: "W. Meeussen" <w.meeussen.vdmcc at vandemoortele.be>
- Date: Thu, 6 Nov 1997 02:40:13 -0500
- Sender: owner-wri-mathgroup at wolfram.com
hi Joana,
something like parts[li_]:=If[AtomQ[li],li,{li,Sequence@@parts/@li}]
At 01:57 5-11-97 -0500, Joana Nunes de Almeida wrote:
>Hello,
>
>I'm doing a project for my Programming course, but I'm having some
>trouble whith one of the exercises.
>I must define a function where when we put in a list the function gives
>back the different parts of the list.
>
>exp: parts[{1,2}]
> gives: [{1,2},{1},{2},{}]
>
>NB: I must define the function recursivly
>
>
Dr. Wouter L. J. MEEUSSEN
w.meeussen.vdmcc at vandemoortele.be
eu000949 at pophost.eunet.be