Ternary compositions General nonassociative rings and algebras mathematics