Using http://mathworld.wolfram.com/AssociatedLegendrePolynomial.html, you can express the associated legendre polynomials in terms of the unassoc ones:
use(orthpoly,legendre)
P := (l,m) -> piecewise(
[m>0, (-1)^m * (1-x^2)^(m/2) * diff( legendre( l, x ), x $ m ) ],
[m=0, legendre( l, x )],
[m<0, (-1)^(-m) * (l+m)!/(l-m)! * P( l,-m )] )