No. I disagree.
Code: Select all
build_filename_db():-
dir(CurrentDir),
console::write("Processing Dir ",CurrentDir),console::nl(),
extension(CurrentSearchExtension),
CurrentFilename = directory::getFilesInDirectoryAndSub_nd(CurrentDir,CurrentSearchExtension),
%console::write("Found Filename ",CurrentFilename),console::nl(),
CurrentExtension = filename::getExtension(CurrentFilename),
CurrentPath = filename::getPath(CurrentFilename),
CurrentName = filename::getname(CurrentFilename),
CurrentNameUpper = string::toUpperCase(CurrentName),
%CurrentNameUpper = toUpperCase(CurrentName),
NameList00 = split(CurrentNameUpper," .[]-()_#"),
NameList = list::removeAll(NameList00,""),
assert_filename(CurrentFilename,CurrentPath,CurrentNameUpper,CurrentExtension,NameList),
PathList = split(CurrentPath,"\\"),
[Head|ReversePathList] = list::reverse(PathList), % EXAMPLE 1
[Next|Rest] = ReversePathList,
console::write(Head,Rest,Next," ",ReversePathList,"\n"),
CurrentPathUpper = string::toUpperCase(CurrentPath),
PathNameList = split(string::toUpperCase(Next)," .[]-()_#"),
fail_if_equal_list(NameList,PathNameList),
assert_filename(CurrentPath,CurrentPath,CurrentPathUpper,CurrentExtension,PathNameList),
fail.
build_filename_db():-
!.
This is an actual working fragment of code that is dealing with lists of strings.
If you look at the line with EXAMPLE 1 as a comment. Head will contain a string and ReversePathList contains the list of remaining elements
So if I debug and halt my code in the second assert_filename line.
PathList = ["i:","usr","movies","Movies 1-99",""]
Head = ""
ReversePathList = ["Movies 1-99","movies","usr","i:"]
So it does seem to work as I expect.