Appendix J

Rule-based system:  Domain-Specific

 

 

 

Clauses

 

 

% Meta-locutionary rule-based system -- domain specific clauses

% DGN 10-18-88

 

 

%%%%%

%%%%%  Program: Domain-specific clauses

%%%%%

 

 

get_subsequence(Index,sequence(Sequence),subsequence(Index,New_list)) :- !,

  same_type_sublist(Sequence,New_list,Index).

 

get_next_subsequence(Sequence,

         subsequence(Old_index,Last_list),

        subsequence(New_index,Next_list)) :- !,

         length(Last_list,Length),

  New_index is Old_index + Length,

  same_type_sublist(Sequence,Next_list,New_index).

 

same_type_sublist(List,Sublist,Index) :- !,

  sublist(List,Temp_sublist,Index),

  complete_same_type_sublist(Temp_sublist,Sublist).

 

sublist(L,L,1) :- !.

sublist([H|T],S,Index) :- !,

  J is Index - 1,

  sublist(T,S,J).

 

complete_same_type_sublist([blank|T1],[blank|T2]) :- !,

  complete_blank_sublist(T1,T2,5).

complete_same_type_sublist([Char|T1],[Char|T2]) :- !,

  complete_char_sublist(T1,T2,5).

 

complete_blank_sublist(_,[],1) :- !.

complete_blank_sublist([blank|T1],[blank|T2],Index) :- !,

  J is Index - 1,

  complete_blank_sublist(T1,T2,J).

complete_blank_sublist(_,[],_).

 

complete_char_sublist(_,[],1) :- !.

complete_char_sublist([],[],_) :- !.

complete_char_sublist([blank|T1],[],_) :- !.

complete_char_sublist([Char|T1],[Char|T2],Index) :- !,

  J is Index - 1,

  complete_char_sublist(T1,T2,J).

 

get_next_letter(Index,List,letter(New_index,New_char)) :- !,

  New_index is Index + 1,

  nth(New_index,List,New_char).