writing mac_learning in xsb