A note on recent pack/pac with application on predicate and function closure

I have reviewed my pack / pac, which is mainly
for closure. About one year ago, once I saw that
the pac broke and took it hard for me to fix, without
investing troubles. However, fortunately recently I happened to notice
that it had not been the case, and in fact, fixing related codes little
by little, now the package seems to work on the latest SWI-Prolog git
better than ever before, with the following prolog flags.

:- set_prolog_flag(optimise, true).
:- set_prolog_flag(qcompile, auto).
:- set_prolog_flag(stack_limit, 44_359_738_368).

For fun, I added a new feature, appication (@) on predicate
cloure and function closure, though for the moment I am not sure
this feature is interesting. Below are some sample queries on
applicatioins without explanations, still hoping some reader
might be interested in them.

  1. ?- append([1], [2])@X.
    X = [1, 2].
  2. ?- append@[1]@[2]@X.
    X = [1, 2].
  3. ?- append@(:append@[1]@[2])@(:append@[3]@[4])@X.
    X = [1, 2, 3, 4].
  4. ?- append@(:append@[1]@[2])@(:append@[3]@[4])@X.
    X = [1, 2, 3, 4].
  5. ?- eval(fun([X,Y]>> :append@X@Y)@[1]@[2], V).
    V = pac_demo:‘pac#3’([1], [2]).
  6. ?- eval(:fun([X,Y]>> :append@X@Y)@[1]@[2], V).
    V = [1, 2].
  7. ?- maplist(append([1,2]), [[a],[b],[c]], Out).
    Out = [[1, 2, a], [1, 2, b], [1, 2, c]].
  8. ?- maplist(append@([1,2]), [[a],[b],[c]], Out).
    Out = [[1, 2, a], [1, 2, b], [1, 2, c]].
  9. ?- pred([a])@X.
    X = a.
  10. ?- rec(F, [, X, X] & ([[X|Y], Z, [X|U]]:- call(F, Y, Z, U)))
    @ [1,2] @ [3,4] @ Out.
    F = ‘pac#9’,
    Out = [1, 2, 3, 4].
  11. test1(F, X, V):- call(F, X, V).
    ?- test1(succ, 1, V).
    V = 2.
  12. test2(F, X, V):- call(pred([G,A,B]:- call(G, A, B)), F, X, V).
    ?- test2(succ, 1, V).
    V = 2.
  13. test3(F, X, V):- F@X@V.
    ?- test3(succ, 1, V).
    V = 2.
  14. test4(F, X, V):- eval(:fun([F,X], >> (:F)@ X), V).
    ?- test4(succ, 1, V).
    V = 2.

Kuniaki Mukai