Tuesday's presidential debate was a triumph for nerds around the world.
Hillary Clinton embraced her role as the biggest know-it-all in American politics. She was lame and boring, sure, but she had studied meticulously, and it showed.
Meanwhile, Donald Trump filled the role of loudmouth class clown and decided to wing it.
The result was an incoherent mess, and we should have seen it coming.
"One (candidate) looks to be hunkering down with homework, research and rehearsals, while the other seems to be taking an on-the-fly casual approach to what could be the most important 90 minutes of the presidential election," NBC reported last week.
Other stories backed that up. Clinton stopped campaigning for four whole days before the debate to prepare. She memorised a file of Trump's various scandals and weaknesses, and staged mock debates to hone her answers.

"Clinton has a thick dossier on Trump after months of research and meetings with her debate team, including analysis and assumptions about his psychological makeup that Clinton advisers described as critical to understanding how to knock Trump off balance," theNew York Times reported.
"Look to be honest I've rehearsed this answer 17 times, so I could do it in my sleep at this point." Photo / AP
While his opponent was busy strategising and building sophisticated psychological profiles, Trump "paid only cursory attention to briefing materials", and couldn't even be bothered to stand at a lectern and sharpen his responses. He also kept campaigning until the eve of the debate, robbing himself of time to cram.
So, to extend the tortured school metaphor we used earlier: Clinton was the student who takes copious amounts of notes and studies for tests weeks in advance, and Trump was the boy lazily scanning his textbook for the first time on the morning of his final exam.
That lack of preparation became more and more obvious with every passing minute of the debate. From about the half-hour mark, Trump's answers deteriorated into rambling streams of consciousness.
Here, for example, is Trump's response to a question about his proposal to cut America's company tax rate.
"They are going to expand their companies and do a tremendous job. I'm getting rid of the great thing for the wealthy, it's a great thing for the middle class and for companies to expand and when these people are going to put billions and billions of dollars into companies and when they are going to bring $2.5 trillion back from overseas where they can't bring the money back because politicians like Secretary Clinton won't allow them to bring the money back because the taxes are so onerous and the bureaucratic red tape, it's so bad.
"So what they are doing is leaving our country and, believe it or not, they are leaving because taxes are too high and because some of them have lots of money outside of our country and instead of bringing it back and putting the money to work because they can't work out a deal and everybody agrees it should be brought back, instead of that, they are leaving our country to get their money because they can't bring their money back into our country because of bureaucratic red tape, because they can't get together. Because we have a president that can't sit them around a table and get them to approve something, and here's the thing, Republicans and Democrats agree that this should be done. $2.5 trillion.
"I happen to think it's double that. It's probably $5 trillion that we can't bring into our country, Lester, and with a little leadership, you'd get it in here very quickly and it could be put to use on the inner cities and lots of other things, and it would be beautiful. But we have no leadership. And honestly, that starts with Secretary Clinton."
The ideal debate answer is clear, coherent and at least somewhat concise. Instead of offering one of those answers, Trump gave us a bunch of scatterbrained, barely relevant run-on sentences with half their grammar missing. That is what happens when you don't practise.
It wasn't an isolated case either. Most of Trump's answers in the final hour followed the same pattern, as he appeared to run out of steam. A full-length mock debate in the lead-up probably would have helped with that.
But mere minutes after walking off stage, Trump was blaming his performance on everything but himself.
"They gave me a defective mic, did you notice that? My mic was defective in the room. I wonder, was that on purpose?" he told journalists.
"I don't want to believe in conspiracy theories, but it was much lower than hers and it was crackling and she didn't have that problem," he added in an interview with Fox News.
Trump claimed he had actually won the debate, citing non-existent polls.

For the record, CNN's official post-debate poll declared Clinton the victor by a margin of 62 per cent to 27. Several online polls gave it to Trump.
Trump's failure to prepare - or even to take responsibility for his failure to prepare - matters a lot, as it exposes him to a potentially lethal line of criticism. You can't be an effective president of the United States if you're lazy.
Clinton started to prosecute that argument during the debate, and it led to her best one-liner: "I think Donald just criticised me for preparing for this debate. And yes, I did. And you know what else I prepared for? I prepared to be president."
It was a brutally effective moment, because while Clinton may be wooden, unrelatable, secretive and dishonest, no one can argue she is unprepared. Thorough preparation is her core strength, and the key feature she's trying to sell to sceptical voters.
Trump could have negated that strength yesterday. He just had to knuckle down, do his homework and give the 80 million Americans watching some reason to believe he was on top of the issues. Instead, he figured he could wing it.
If that ends up costing Trump on election day, it will be his own fault.

The snap analyses of Monday night's debate came with a hard caveat. Donald Trump has broken the political media's antenna, again and again. Gaffes that would have torpedoed other candidates and other campaigns did not slow him down. Similar gaffes, like Trump's comment about "the Second Amendment people" stopping Hillary Clinton from swinging the Supreme Court and his later comment that the Secret Service should stop protecting her, got wildly different voter reactions.
That's led to uncertainty about what would normally be a clear, clean storyline - that Trump lost the debate. The efforts of Trump's online army to counter-spin this have been limited to trending the hashtag #TrumpWon, as TV networks and almost all analysts say otherwise. But in the hours after Trump and Clinton left Long Island, we've seen five narratives of how maybe, possibly, Trump got the better of things.
1. Hillary was too prepped. Moments after the debate ended, Trump's top surrogates in the Hofstra University spin room began insisting that a "human" candidate had gone up against a sort of talking point cyborg.
"The undecideds saw a human being in Donald Trump," said Republican Chris Collins, one of the first members of Congress to back Trump. "If you're saying something about me, and I don't like it, then I'm going to interrupt you. I thought it was strange, a couple of times, that she didn't interrupt him."
The idea here is to exploit the authenticity gap, a source of endless frustration for Democrats who cannot understand how the host of The Apprentice is seen as more honest than Clinton. Trump has survived countless controversies with a retreat to that framework - he tells it like it is, and politicians don't talk.
2. Trump won the first 15 minutes, so maybe people stopped watching after that. The asymmetry between Trump's scrappy campaign and Clinton's Death Star - as well as Trump's decision to keep talking about his fat-shaming of a Miss Universe winner - is helping Clinton win the morning-after spin. But Trump's campaign has been running a tight clip from the debate, one of the very first exchanges, as an ad. It's easy to see why, as Trump boils down his best "outsider" argument and asks why Clinton has not achieved her goals after a life in politics. "He was better early," wrote Stephen Hayes in the generally Trump-skeptical Weekly Standard. "Better to be better early."
3. Trump won on the economy. True to form, Slate (where I worked from 2010 to 2014) published a contrary take on the debate in which Trump's dominance of a key, early question steered Clinton into a near disaster. "Trump bullied his way through, at times barely letting her finish a stammering thought, but he also made one point that resonates with what so many distrustful working-class whites in the Midwest know to be true," wrote Jordan Weissmann, the site's economics columnist. "Clinton has been a politician for a long time. Where was she on trade before this presidential race?"
There is anecdotal evidence that voters noticed. While most quick-take focus groups found Clinton the winner of the debate, McClatchy - Trump's new favourite news source, non-Sean Hannity division - found a collection of voters who found Clinton "pie in the sky" and Trump concrete. That's risky for the Democrat. Her economic answer synthesized years of liberal think tank ideas, the rhetoric of Bernie Sanders, and the recent, successful records of Democratic presidents. It did not connect the way that Trump's primary-winning rhetoric - "we're getting killed on jobs" connected.
4. Trump lost on points but seemed credible enough. Breitbart News, which has loaned its CEO to the Trump campaign through the election, commissioned a "flash poll" of its own. The bad news for readers was that Clinton was seen as the winner of the debate. The good news: He managed to convince some waverers that he could indeed be president.
"This debate did not shift the race," insisted pollster Pat Caddell. "What it did do was show Trump as plausible, as a strong leader and more importantly that he cares about people."
This was the going theory, before the debate, of how Trump could win it. No analyst thought that the business mogul would outwit the former secretary of state. The theory was that he would become a plausible president, a face and voice it was possible to see in the Oval Office. The snap polls did not indicate this, but the hunt is on to prove that voters did.
5. Clinton missed the kill shot. The Democratic nominee's decision to goad Trump then sit back as he tripped over his shoelaces seemed to deliver for her. But it did not deliver the sort of victory that ends a campaign, or starts a panic in the opposing camp, like Lloyd Bentsen's humiliation of Dan Quayle in 1988 or Gerald Ford's tangled explanation of whether Poland was under Soviet domination in 1976. To some observers, it could have, had Clinton sprung on Trump when he glibly said he paid no taxes because he was "smart."
"Clinton was on a roll, clearly hoping to get through prepared material, and she let Trump off the hook with all the people who play by the rules," wrote Jeb Lund inRolling Stone. "Are they stupid? Are people who obey the law morons? Is everyone who thinks they should pitch in for roads and schools a chump? And how ethical are Trump's smarts? Is he legally paying zero taxes, or is he putting himself on the same plane of financial genius as Al Capone?"
Clinton's campaign latched onto the tax answer and clearly sees it as a weapon for the final stretch of the campaign. But it's not dominating coverage of the debate like it could have; accordingly, Clinton's frustrated attacks on Trump's refusal to release his taxes have not broken through.