Question: unapply to define piecewise function

Dear all
I have a problem using unapply to construct all functions defined in each intervals.
If I use unapply to construct only two peicewises fuctions the code work well, but otherwise there is someting missing 
splineProb.mw

## using code like this, its run 
ff:=unapply
                  ( piecewise
                    ( x < eval( Xlist[2], NaturalCoeffs),
                      expand( eval( S[1], NaturalCoeffs) ),
                                           expand( eval( S[3], NaturalCoeffs) )
                    ),
                    x
                  );
 

but using code like 
 

unapply
                  ( piecewise
                    ( x < eval( Xlist[2], NaturalCoeffs),
                      expand( eval( S[1], NaturalCoeffs) ),
                     ( x < eval( Xlist[3], NaturalCoeffs),
                      expand( eval( S[2], NaturalCoeffs) ),

                      expand( eval( S[3], NaturalCoeffs) )
                    ),
                    x
                  );
does not run and return 
Error, `;` unexpected
 

Thank you for your help 

Please Wait...