lists

March 06 2010 by mathperson 32
false
Maple

0


tlist := [ [s] ]:
  for j to 4 do
    if tlist[-1,1]=s then
      tlist := [ tlist[], [t,tlist[-1][]] ]
    else
   tlist := [ tlist[], [s,tlist[-1][]] ]
  end if
 end do:
tlist;
 

which gives result

[[s], [t, s], [s, t, s], [t, s, t, s], [s, t, s, t, s]]

 

is there an easier way of writing this?

 
Loading Comments & Answers

You must be logged into your MaplePrimes account in order to post a comment. If you don't have an account, you can create an account here.

     

Forgot Your Password? Create an Account