The Functional Method for the Domain-Wall Partition Function