How to state a negative fact in Pyke?

Say I have a fact file:

code_in_git(a)
code_in_git(b)
code_in_git(c)
build_on_disk(a)
build_on_disk(c)

I want to approve the rule "if code_in_git ($ branch), not build_on_disk ($ branch), create the fact need_build ($ branch)". How can i do this?

+4
source share
1 answer

Well, it seems I can assert them with notany:

no_build_on_disk
    foreach
        deploy.code_in_git($branch)
        notany
            deploy.build_on_disk($branch)
    assert
        deploy.needs_build($branch)
+5
source

All Articles