I stumbled upon this version of the Sakamoto algorithm
dow(m,d,y){y-=m<3;return(y+y/4-y/100+y/400+"-bed=pen+mad."[m]+d)%7;}
I tried it on ideone.com and it actually works. I'm not interested in how the algorithm works, it's the syntax that baffles me.
I consider myself an intermediate C programmer and I have absolutely no idea what's going on in the "-bed=pen+mad."[m] part of the code.
What is that???