Programmed assembly of pi-conjugated molecules and polymers