Homeland Security Secretary Kirstjen Nielsen, left, walks next to a section of the border wall fortified with razor wire separating Tijuana, Mexico, and San Diego on Nov. 20. (Gregory Bull/AP)

THE HUNDREDS of thousands of young undocumented immigrants who have grown up in this country, having been brought here by their parents as children, are known as “dreamers.” But the real dreamer is President Trump if he thinks Congress will appropriate the billions of dollars he wants for his border wall — the one he claimed Mexico would pay for — even as he refuses any reasonable compromise to provide permanent legal status for those young migrants.

Mr. Trump’s last best chance for the wall, his signature 2016 campaign promise, may come during this lame-duck session of Congress. The window is narrow and the odds long, but the president could exercise his influence over the soon-to-disappear Republican majority in the House to press for a deal that would trade substantial funding for border security — including portions of a wall — for legislation that would assure a stable future for the dreamers. Instead, he suggests he would rather shut down the government than reach a compromise. Where’s the art in that deal?

A straightforward swap of wall funding for a dreamer fix should be an easy sell to the president’s base. Three-quarters of Republicans support giving dreamers a path to citizenship, and roughly the same percentage back the president on the wall, according to a recent Gallup poll. Several groups affiliated with the Koch network, major GOP donors, have also written to congressional leaders endorsing a deal. Democrats almost unanimously favor citizenship or at least legal status for the dreamers, and, while few of them want a border wall, many might accept significant funding for one if it meant removing the risk of deportation faced by well more than a million dreamers.

Granted, in Congress there are hard-liners on both sides who reject any wall-for-dreamers compromise. One of them is Rep. Nancy Pelosi (Calif.), potentially the next speaker when the Democrats take control of the House in January, who says no sweetener would be sufficient for her to support a border wall. Plenty of Republicans are equally dismissive of what they disdain as “amnesty” for dreamers.

Yet it is the president who has most effectively poisoned the waters for a compromise. When offered such an arrangement in the past, he thumbed his nose at it. And he has killed other attempts at immigration legislation by freighting it with maximalist demands, including draconian cuts to legal immigration levels.

During the lame-duck session in 2010, Congress managed to enact an array of measures — though it narrowly failed to pass the Dream Act, which would have provided a path to citizenship for the dreamers. Now, both sides have a greater impetus for a deal — Democrats, because the Supreme Court may well uphold Mr. Trump’s decision to rescind Obama-era work permits and protection from deportation for dreamers; and Republicans, because hopes for a border wall are likely to vanish next year with the arrival of the House’s incoming Democratic majority.

The clock is ticking. At the moment, there is more talk in Congress of a government shutdown if spending bills are not passed by Dec. 7 than of a wall-for-dreamers deal that would secure a major victory for each side. How is that rational or responsible?