Skip to content

Commit

Permalink
Handle codelists for #115
Browse files Browse the repository at this point in the history
  • Loading branch information
TeamSPoon committed Sep 8, 2024
1 parent 6bf9340 commit 06594b3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions prolog/metta/metta_loader.pl
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@
wwp(Fnicate, Virtual) :- var(Virtual),!,throw(var_wwp(Fnicate, Virtual)).
wwp(Fnicate, Dir) :- is_scryer, symbol(Dir), !, must_det_ll((path_chars(Dir,Chars), wwp(Fnicate, Chars))).

% catches charlist and codelist filenames
wwp(Fnicate, Chars) :- is_list(Chars), catch(name(File,Chars),_,fail), Chars\==File,!, wwp(Fnicate, File).

wwp(Fnicate, File) :- is_list(File), !,
must_det_ll((maplist(wwp(Fnicate), File))).
Expand All @@ -93,6 +95,7 @@
afn(Outter, Dir,[solutions(all), access(read), file_errors(fail)]),
with_cwd(Dir,wwp(Fnicate, Inner)),!.

% this is what captures string in SWI-Prolog
wwp(Fnicate, Chars) :- \+ is_scryer, \+ symbol(Chars), !, must_det_ll((name(Atom,Chars), wwp(Fnicate, Atom))).

wwp(Fnicate, File) :- exists_file(File), !, must_det_ll(( call(Fnicate, File))).
Expand Down Expand Up @@ -298,8 +301,8 @@
% Call loonit_report (likely for logging or reporting purposes).
loonit_report.
load_metta1(Self, RelFilename):-
% Ensure that the relative filename is an atom and exists as a valid file.
must_det_ll((atom(RelFilename),
% Ensure that the relative filename is a path and exists as a valid file.
must_det_ll((symbol(RelFilename), % @TODO or a string?
exists_file(RelFilename),!,
% Convert the relative filename to an absolute filename.
afn_from(RelFilename, Filename),
Expand Down

0 comments on commit 06594b3

Please sign in to comment.