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

Package "each_call_cleanup"

Title:Each Call Redo Setup and Cleanup
Rating:Not rated. Create the first rating!
Latest version:1.1.118
SHA1 sum:fc61071b76343a40a750cb51f86e8c26c55054af
Author:Douglas R. Miles <logicmoo@gmail.com>
Maintainer:TeamSPoon https://github.com/TeamSPoon/
Packager:TeamSPoon/LogicMoo https://github.com/TeamSPoon/
Home page:https://github.com/TeamSPoon/each_call_cleanup
Download URL:https://github.com/TeamSPoon/each_call_cleanup/releases/*.zip

Reviews

No reviews. Create the first review!.

Details by download location

VersionSHA1#DownloadsURL
0.0.25d47f58d01a347b51cc6018e8e4fff09e9efc8e61https://github.com/TeamSPoon/each_call_cleanup.git
0.0.71541264c294ed34c6d5b26dced1c20a38dcc7df61https://github.com/TeamSPoon/pack_each_call_cleanup.git
932eea45680e3b8ca73571271188e6bcaf5b790c1https://github.com/TeamSPoon/each_call_cleanup.git
1.1.1129c6ac1d3648ffc003ee36f9bdb4ae27274beeb521https://github.com/TeamSPoon/each_call_cleanup.git
1.1.11581e5ee2ed8749a29b17d1f78a322e9d23e63999c1https://github.com/TeamSPoon/each_call_cleanup.git
1.1.1175ad25205c6c3a26676f78d1b697dd69e945fb56a1https://github.com/TeamSPoon/each_call_cleanup.git
1.1.1184b5c66f653effc926b3cf81a76acc79d98d188292https://github.com/TeamSPoon/each_call_cleanup.git
5b80ae812001a4c09925fc6832ccbc54d9a3d43015https://github.com/TeamSPoon/each_call_cleanup.git
b042d55d2e39f84d2c426df778cd0722104cf7002https://github.com/TeamSPoon/each_call_cleanup.git
c2f3b8518afe6a295830f1bd4b2236973e9dc4ba1https://github.com/TeamSPoon/each_call_cleanup.git
fc61071b76343a40a750cb51f86e8c26c55054af1https://github.com/TeamSPoon/each_call_cleanup.git

Call A Goal On Each Redo

Installation using SWI-Prolog 7.1 or later:

?- 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),
     each_call_cleanup(
         set_prolog_flag(Flag,Value),
          Goal,
           set_prolog_flag(Flag,Was)).
 
 

 % notrace/1 that is not like once/1
 quietly(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)).

Some TODOs

Document this pack!

Write tests

Untangle the 'pack' install deps (Moving predicates over here from logicmoo_base)

Not obligated to maintain a git fork just to contribute

Dislike having tons of forks that are several commits behind the main git repo?

Be old school - Please ask to be added to TeamSPoon and Contribute directly !

Still, we wont stop you from doing it the Fork+PullRequest method

BSD 2-Clause License

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

Contents of pack "each_call_cleanup"

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