"Anaphora" is a term from the science of rhetoric, or the use of language as a form of persuasion. Whitman wrote his best poems around the middle of the 19th century, a time when political rhetoric and speechmaking had reached great heights. Public speakers, or orators, were big celebrities. In fact, they would often pass through the same kind of lecture halls as the one in which the astronomer gives his lesson. Anaphora is one of the best tools in the speaker's toolbox, and Whitman had obviously learned from the orators of his day, because he uses it everywhere in his poetry. In this poem, anaphora occurs in the repetition of "when" in the first four lines. If you're still having a hard time recognizing this term, just think of Martin Luther King's "I Have a Dream" speech. The repeated use of the phrase "I Have a Dream" is one of the most famous examples of anaphora we know of. It gives that speech a distinct flavor of poetry.