This is based on K. Another array language is J http://jsoftware.com In J this would be:
dot =: +/ . *
P =: 2 3 4
Q =: 1 0 2
P dot Q
That will return 10, the dot product P and Q.