f=lambda d,m,x='NESW'*2:x[x.find(d)+2*(m=='/\\'[d in'NS'])-1] for d in 'NESW': for m in '/\\': print d, m, '-->', f(d, m)
Standard input is empty
N / --> W N \ --> E E / --> S E \ --> N S / --> E S \ --> W W / --> N W \ --> S
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!