Butter the sides of a heavy 2-quart saucepan. In it combine sugar, milk, chocolate, and corn syrup. Cook and stir over medium-high heat till sugar dissolves and mixture comes to boiling. Continue cooking over medium-low heat to 234 degrees F (soft-ball stage), stirring frequently (mixture should boil gently over entire surface). Remove from the heat; add margarine and vanilla, but do not stir. Cool without stirring to lukewarm (110 degrees F), about 55 minutes. Add nuts. Beat vigorously about 7 minutes, or until fudge becomes very thick and just starts to lose its gloss. Immediately spread in a buttered 9x5x3 inch loaf pan. Score into squares while warm, cut when firm.