<commit_before>%
%  marelle
%
%  Test driven system administration.
%

%
%  WRITING DEPS
%
%  You need one each of these three statements. E.g.
%
%  pkg(python).
%  met(python, _) :- which(python, _).
%  meet(python, osx) :- bash('brew install python').
%
:- multifile pkg/1.
:- multifile meet/2.
:- multifile met/2.
:- multifile depends/3.

:- dynamic platform/1.

% pkg(?Pkg) is nondet.
%   Is this a defined package name?

% met(+Pkg, +Platform) is semidet.
%   Determine if the package is already installed.

% meet(+Pkg, +Platform) is semidet.
%   Try to install this package.

% where to look for dependencies
marelle_search_path('~/.marelle/deps').
marelle_search_path('marelle-deps').
marelle_search_path('deps').

%
%  CORE CODE
%
%

main :-
    ( current_prolog_flag(os_argv, Argv) ->
        true
    ;
        current_prolog_flag(argv, Argv)
    ),
    append(Front, Rest, Argv),
    length(Front, 6), !,
    detect_platform,
    load_deps,
    main(Rest).

main([scan|R]) :-
    ( R = ['--all'] ->
        scan_packages(all)
    ; R = ['--missing'] ->
        scan_packages(missing)
    ; R = [] ->
        scan_packages(unprefixed)
    ).

main([list|Rest]) :-
    ( Rest = [] ; Rest = [Pattern] ),
    !,
    ( Rest = [] ->
        findall(P, (pkg(P), \+ ishidden(P)), Ps0)
    ; Rest = [Pattern] ->
        join(['*', Pattern, '*'], Glob),
        findall(P, (pkg(P), wildcard_match(Glob, P), \+ ishidden(P)), Ps0)
    ),
    sort(Ps0, Ps),
    (
        member(P, Ps),
        writeln(P),<commit_msg>Improve backtracking call to append/3.<commit_after>%
%  marelle
%
%  Test driven system administration.
%

%
%  WRITING DEPS
%
%  You need one each of these three statements. E.g.
%
%  pkg(python).
%  met(python, _) :- which(python, _).
%  meet(python, osx) :- bash('brew install python').
%
:- multifile pkg/1.
:- multifile meet/2.
:- multifile met/2.
:- multifile depends/3.

:- dynamic platform/1.

% pkg(?Pkg) is nondet.
%   Is this a defined package name?

% met(+Pkg, +Platform) is semidet.
%   Determine if the package is already installed.

% meet(+Pkg, +Platform) is semidet.
%   Try to install this package.

% where to look for dependencies
marelle_search_path('~/.marelle/deps').
marelle_search_path('marelle-deps').
marelle_search_path('deps').

%
%  CORE CODE
%
%

main :-
    ( current_prolog_flag(os_argv, Argv) ->
        true
    ;
        current_prolog_flag(argv, Argv)
    ),
    append([_, _, _, _, _, _], Rest, Argv),
    detect_platform,
    load_deps,
    main(Rest).

main([scan|R]) :-
    ( R = ['--all'] ->
        scan_packages(all)
    ; R = ['--missing'] ->
        scan_packages(missing)
    ; R = [] ->
        scan_packages(unprefixed)
    ).

main([list|Rest]) :-
    ( Rest = [] ; Rest = [Pattern] ),
    !,
    ( Rest = [] ->
        findall(P, (pkg(P), \+ ishidden(P)), Ps0)
    ; Rest = [Pattern] ->
        join(['*', Pattern, '*'], Glob),
        findall(P, (pkg(P), wildcard_match(Glob, P), \+ ishidden(P)), Ps0)
    ),
    sort(Ps0, Ps),
    (
        member(P, Ps),
        writeln(P),
{'fraction_non_alphanumeric': 0.18017722349852314, 'fraction_numerical': 0.00590744995077125, 'mean_word_length': 2.5649122807017544, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '441665', 'n_tokens_mistral': 1181, 'n_tokens_neox': 1123, 'n_words': 245}