hi, yes i think i am referring to what is considered as repeat-fail loops.
i can give some very good examples of codes which are very difficult to read, here is 1 example, the flow patterns are not specified, and there are about 20-30 of such clauses repeated under eachother, you could re-write this with repeat fail loop a lot more simple, Could indeed be a good idea to use maplist because earlier i never understood the idea of maplist. the code i paste here is visual-prolog code.Currently i am writing in swi-prolog , / i have already written ( in a relative ugly way ( because i was in a hurry)), / i would like to write a swi-prolog small script which can isolate prolog code from existing source files, for example 1 predicate chosen with all other predicates it uses, and it isolates all the substracted code in a new file.
imp_op_interne(_,_,_,_,_,N,N,_Font,_Nom_par_ligne,_Caractere,_HAUT,_Interligne,_Nomb_col,_Gauche,_Largeur,St,St,_,_,Si_bold):-!.
imp_op_interne(_,_,[],_,_,_,_,_Font,_Nom_par_ligne,_Caractere,_HAUT,_Interligne,_Nomb_col,_Gauche,_Largeur,St,St,_,_,Si_bold):-!.
% = 8 options
imp_op_interne(NbOptSel,Avec_prix,[D|F],[Dp|Fp],[Dpop|Fpop],8,99,FONT,1,Caractere,_,Interligne,Nomb_col,Gauche,Largeur,Ste,StX,Style,Color,Si_bold):-
HAUT = 630,
HAUT1=HAUT+Interligne,
retractall(option_2_pages_string(_)),
format(Si_pxopA, "text \"% \" at(%1.0,%1.0,%1.0,%1.0) fontname=% fontsize=% border=0 alignment=right fontstyle=normal % %",Dpop,1800,HAUT,2040,HAUT1,Style,Caractere,Color,";\n"),
si_avec_prix_1_col(Avec_prix,1,"",Si_pxopA,_,Caractere,_,Si_pxop),
format(Sts1, "%text \"% \" at(%1.0,%1.0,%1.0,%1.0) fontname=% fontsize=% border=0 alignment=left fontstyle=normal % %", "",D,200,HAUT,1500,HAUT1,Style,Caractere,Color,";\n"),
format(St_2pages, "%1%text \"% \" at(%1.0,%1.0,%1.0,%1.0) fontname=% fontsize=% border=0 alignment=right fontstyle=normal % %",Si_pxop,Sts1,Dp,1550,HAUT,1800,HAUT1,Style,Caractere,Color,";\n"),
retractall(option_2_pages_bas(_)),
asserta(option_2_pages_bas(HAUT1)),
asserta(option_2_pages_string(St_2pages)),!,
imp_op_interne(NbOptSel,Avec_prix,F,Fp,Fpop,9,99,Font,1,Caractere,HAUT1,Interligne,Nomb_col,Gauche,Largeur,Ste,StX,Style,Color,Si_bold).
imp_op_interne(NbOptSel,Avec_prix,[D|F],[Dp|Fp],[Dpop|Fpop],N,99,FONT,1,Caractere,HAUT,Interligne,Nomb_col,Gauche,Largeur,Ste,StX,Style,Color,Si_bold):-
HAUT1=HAUT+Interligne,
retract(option_2_pages_string(Anc_stt2page)),
format(Si_pxopA,"text \" % \" at(%1.0,%1.0,%1.0,%1.0) fontname=% fontsize=% border=0 alignment=right fontstyle=normal % %", Dpop,1800,HAUT,2040,HAUT1,Style,Caractere,Color,";\n"),
si_avec_prix_1_col(Avec_prix,1,"",Si_pxopA,_,Caractere,_,Si_pxop),
format(Sts1,"%text \" % \" at(%1.0,%1.0,%1.0,%1.0) fontname=% fontsize=% border=0 alignment=left fontstyle=normal % %", Anc_stt2page,D,200,HAUT,1500,HAUT1,Style,Caractere,Color,";\n"),
format(St_2pages,"%1%text \" % \" at(%1.0,%1.0,%1.0,%1.0) fontname=% fontsize=% border=0 alignment=right fontstyle=normal % %", Si_pxop,Sts1,Dp,1550,HAUT,1800,HAUT1,Style,Caractere,Color,";\n"),
asserta(option_2_pages_string(St_2pages)),
retractall(option_2_pages_bas(_)),
asserta(option_2_pages_bas(HAUT1)),
NN=N+1,!,
imp_op_interne(NbOptSel,Avec_prix,F,Fp,Fpop,NN,99,Font,1,Caractere,HAUT1,Interligne,Nomb_col,Gauche,Largeur,Ste,StX,Style,Color,Si_bold).
imp_op_interne(NbOptSel,Avec_prix,[D|F],[Dp|Fp],[Dpop|Fpop],N,Maxi,FONT,1,Caractere,HAUT,Interligne,Nomb_col,Gauche,Largeur,Ste,StX,Style,Color,Si_bold):-
HAUT1=HAUT+Interligne,
format(Si_pxopA,"text \"%\" at(%1.0,%1.0,%1.0,%1.0) fontname=% fontsize=% border=0 alignment=right fontstyle=normal % %", Dpop,1800,HAUT,2040,HAUT1,Style,Caractere,Color,";\n"),
si_avec_prix_1_col(Avec_prix,1,"",Si_pxopA,_,Caractere,_,Si_pxop),
format(Sts1,"%text \" %\" at(%1.0,%1.0,%1.0,%1.0) fontname=% fontsize=% border=0 alignment=left fontstyle=normal % %", Ste,D,50,HAUT,1000,HAUT1,Style,Caractere,Color,";\n"),
format(Sts,"%1%text \"%\" at(%1.0,%1.0,%1.0,%1.0) fontname=% fontsize=% border=0 alignment=left fontstyle=normal % %", Si_pxop,Sts1,Dp,1020,HAUT,2030,HAUT1,Style,Caractere,Color,";\n"),
NN=N+1,!,
imp_op_interne(NbOptSel,Avec_prix,F,Fp,Fpop,NN,Maxi,Font,1,Caractere,HAUT1,Interligne,Nomb_col,Gauche,Largeur,Sts,StX,Style,Color,Si_bold).