The notion that history might easily have gone otherwise is as humbling as a planetarium show and a rich source of plots for speculative fiction. What if Lincoln had lost, or Hitler won? What if the Russian Revolution had never occurred, or the Trinity test had fizzled? What if Khrushchev and Kennedy had pushed those buttons in 1962? In their first collaboration, William Gibson and Bruce Sterling, the Katzenjammer Kids of mid-'80s cyberpunk science fiction, have spun out a strange, frightening, often funny, and utterly convincing tale from the question ''What if computers had been invented 150 years ago, in Queen Victoria's London?''
It's hardly an idle premise. Throughout the 1820s and '30s, there actually were government-financed attempts in England to build a steam-powered ''analytical engine'' an engine that could calculate and store information on punch cards based upon the designs of Cambridge mathematician Charles Babbage. Although the funding was withdrawn before completion of the computer, in The Difference Engine (Bantam Spectra, $19.95) the machine is not only finished, it's perfected and put into general use and, oh, what a difference instant data makes!
Credit cards and word processors, machine guns, armored tanks (to fight the Cheyenne ''savages'' in Wyoming), and fast-food restaurants are all logically in place by 1855, as are Central Statistics Bureaus, accelerated industrialization (and pollution), unions, motion pictures, and the scientist- politician. Political alliances, even the shapes of nations are affected: Napoleon is a staunch friend of the British Crown, and North America, thanks to European intrigue, is balkanized into four separate and warring republics. ''The swift progression of Enginery,'' write Gibson and Sterling, ''had swept a whole generation in its wake, like some mighty locomotive of the mind.''
No matter how ingenious and irresistible, though, world-building still demands a good story to pop it into life. The authors have been generous enough to come up with three good stories, each one linked to the others by a convenient but effective MacGuffin: a box of computer punch cards of sinister purpose that keeps turning up and then disappearing. The cards originally belong to a publicist for General Sam Houston (exiled president of the Republic of Texas), but, following an evening of political assassinations, they fall into the successive possession of an educated prostitute whose Luddite father was executed by Lord Babbage's computer revolutionaries, a paleontologist saddled with the conflicted id of the truly eminent Victorian, and a ''dark-lantern'' man a gentleman spy.
Smartly plotted, wonderfully crafted, and written with sly literary wit ; (here a pastiche of 19th-century pornography, there a parody of dime adventure novels, and everywhere a tip of the hat to the expansive fiction of Charles Dickens), The Difference Engine like its eponymous steam-driven brass computer spins marvelously and runs like a dream.