A.5 library(broadcast): Broadcast and receive event notifications
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • The SWI-Prolog library
        • library(broadcast): Broadcast and receive event notifications
          • broadcast/1
          • broadcast_request/1
          • listen/2
          • listen/3
          • unlisten/1
          • unlisten/2
          • unlisten/3
          • listening/3
    • Packages
Availability::- use_module(library(broadcast)).(can be autoloaded)
Sourcebroadcast_request(+Term)
Unlike broadcast/1, this predicate stops if an associated goal succeeds. Backtracking causes it to try other listeners. A broadcast request is used to fetch information without knowing the identity of the agent providing it. C.f. “Is there someone who knows the age of John?” could be asked using
        ...,
        broadcast_request(age_of('John', Age)),

If there is an agent (listener) that registered an‘age-of’service and knows about the age of‘John’this question will be answered.