このfor/3を実装するのに、結構試行錯誤したわ
http://www.ifcomputer.com/IFProlog/Manuals/v4.1/reference/for/home_en.html

Prologって全然直感的じゃないな