I see.
However still it is not clear for me how to separate a string into such atoms as this case.
Anyway on this question, I have to take time to learn how the first argument (input command as a list) is processed by process_create and thread_create.
Thanks.
EDIT
I tried to follow a sample codes in help(process_create)
like below, which
was surprisingly simple, though I am far from familiar with process things.
Anyway the sample codes seems enough for my purpose to call simple shell command from Prolog codes.
% ?- choose_folder(X).
%@ 2023-05-17 00:11:05.073 osascript[48546:12223914] +[CATransaction synchronize] called within transaction
%@ X = ['/Users/cantor/Desktop/pdfs/'].
choose_folder(Lines) :-
setup_call_cleanup(
process_create(path(choosefolder), [],
[ stdout(pipe(Out))
]),
read_lines(Out, Lines),
close(Out)).
read_lines(Out, Lines) :-
read_line_to_codes(Out, Line1),
read_lines(Line1, Out, Lines).
read_lines(end_of_file, _, []) :- !.
read_lines(Codes, Out, [Line|Lines]) :-
atom_codes(Line, Codes),
read_line_to_codes(Out, Line2),
read_lines(Line2, Out, Lines).