It seems that SWI-Prolog offers closure expansion. We can for example define:
goal_expansion(println(X), (write(X), nl)). test :- call(println,\'Hello W