context-v1.lp
No OneTemporary

File Metadata

Created
Thu, Jul 9, 6:07 AM

context-v1.lp

%INPUT:
% kleo_registered_subjects(Scope, Option, Subject)
%bind_scope_decision - scope has decision for demand of one of its subscopes.
% CLIENTS
%===========================================================
% clients defined downstream
%Register fn argument demand
kleo_registered_subjects(ScopeCaller, kleo_arg(Subject), Guard):-
kleo_fn_demand(Fn, Subject);
cfa_parent(ScopeCallee, function(Fn));
kleo_registered_subjects(ScopeCallee, Subject, Guard);
cfa_call(ScopeCaller, Fn).
% DEMAND
%===========================================================
%local demand
kleo_scope_demand(Scope, Subject):-
not kleo_scope_decision(Scope, Subject, _);
kleo_registered_subjects(Scope, Subject, Decision).
%demand propagation: scope
kleo_scope_demand(Scope, Subject):-
kleo_scope_demand(ScopeChild, Subject);
cfa_parent(ScopeChild, scope(Scope)).
%propagation: interfn
kleo_fn_demand(Fn, Subject):-
kleo_scope_demand(ScopeFnBody, Subject);
cfa_parent(ScopeFnBody, function(Fn)).
% DECISIONS
%===========================================================
%local decision
kleo_scope_decision(Scope, Subject, Decision):-
bind_scope(Scope, Decision, strong);
kleo_registered_subjects(Scope, Subject, Decision).
%interfn decision
%kleo_scope_decision(ScopeSource, parameter(Subject), Decision):-
% weak(bind_scope(Scope, Decision), ScopeSource);
% kleo_registered_subjects(Scope, Subject, Decision).

Event Timeline