This commit was generated by cvs2svn to compensate for changes in r4,
which included commits to RCS files with non-trunk default branches. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@5 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
26
CHR/chr/concat.pl
Normal file
26
CHR/chr/concat.pl
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
|
||||
:- module( concat, [concat_name/2]).
|
||||
|
||||
concat_name( List, Name) :- List=[_|_],
|
||||
conc_parts( List, Chs, []),
|
||||
atom_codes( Name, Chs).
|
||||
concat_name( F/A, Name) :-
|
||||
conc_part( F/A, Chs, []),
|
||||
atom_codes( Name, Chs).
|
||||
|
||||
conc_parts( []) --> [].
|
||||
conc_parts( [P]) --> !, conc_part( P).
|
||||
conc_parts( [P|Ps]) -->
|
||||
conc_part( P),
|
||||
"_",
|
||||
conc_parts( Ps).
|
||||
|
||||
conc_part( F/A) --> !, name( F), "/", name( A).
|
||||
conc_part( X ) --> name( X).
|
||||
|
||||
name( A) --> {name(A,Chars)}, copy( Chars).
|
||||
|
||||
copy( []) --> [].
|
||||
copy( [C|Cs]) --> [ C ], copy( Cs).
|
||||
|
||||
Reference in New Issue
Block a user