# What’s behind \over?

Typically a TeX command have arguments coming after it. But the command \over, which is used to produce fractions, can access the token before it. How exactly is it implemented and can I define a custom command like that?

-
This is exactly the question that got me reading the TeXbook! My understanding is that this behaviour is compiled into TeX; it's always maintaining a tokslist, just in case it happens to hit an \over. Perhaps one could hook into this tokslist? – L Spice Jan 30 '12 at 21:31
I remember once I found a command that takes a command and prints its definition, with which I tested \over but got nothing. I too guessed it was built-in but still hoped there was a way to access the token list (although David’s answer seems to imply there’s no way to do that…). – J̲C̲ Jan 30 '12 at 21:45
@LSpice Actually TeX always maintains the "current math list" (in math mode) and when it finds \over it puts this list aside, starts another math list and when this one is over it builds the fraction from the two lists. – egreg Jan 30 '12 at 21:52
@egreg thanks! (Plus some characters.) – L Spice Jan 30 '12 at 22:12