Did you know ... Search Documentation:
Packs (add-ons) for SWI-Prolog

Package "call_cleaup_each"

Title:Call A Goal On Each Redo
Rating:Not rated. Create the first rating!
Latest version:0.0.1
SHA1 sum:9ae68777d8712b90a027f319d57d9a9f75838cae
Author:Douglas R. Miles <logicmoo@gmail.com>
Maintainer:Douglas R. Miles <logicmoo@gmail.com>
Packager:Douglas R. Miles <logicmoo@gmail.com>
Home page:https://github.com/TeamSPoon/call_cleaup_each
Download URL:https://github.com/TeamSPoon/call_cleaup_each/releases/*.zip

Reviews

No reviews. Create the first review!.

Details by download location

VersionSHA1#DownloadsURL
0.0.19ae68777d8712b90a027f319d57d9a9f75838cae1https://github.com/TeamSPoon/each_call_cleanup.git

Call A Goal On Each Redo

Installation using SWI-Prolog 7.1 or later:

?- pack_install(each_call_cleanup).

or

?- pack_install('https://github.com/TeamSPoon/each_call_cleanup.git').

Source code available and pull requests accepted at http://github.com/TeamSPoon/each_call_cleanup

Example usages:


 
 with_prolog_flag(Flag,Value,Goal):-
    (current_prolog_flag(Flag,Was)-> Cleanup = set_prolog_flag(Flag,Was); true),
     each_call_cleanup(
         set_prolog_flag(Flag,Value),
          Goal,
           Cleanup).
 
 

 % notrace/1 that is not like once/1
 no_trace(Goal):-
    tracing ->
      each_call_cleanup(notrace,Goal,trace);
      Goal.
    
            
 

 % Trace non interactively
 rtrace(Goal):-
    ( tracing-> Undo=trace ; Undo = notrace ),
    '$leash'(OldL, OldL), '$visible'(OldV, OldV),
    each_call_cleanup(
         (notrace,visible(+all),leash(-all),leash(+exception),trace),
         Goal,
         (notrace,'$leash'(_, OldL),'$visible'(_, OldV),Undo)).

BSD 2-Clause License

Copyright (c) 2017, Douglas Miles <logicmoo@gmail.com> All rights reserved.

Contents of pack "call_cleaup_each"

Pack contains 5 files holding a total of 5.8K bytes.