| Did you know ... | Search Documentation: |
| Pack starlog -- OPERATOR_SELECTION_SUMMARY.md |
"Complete 3 is 1(A is +;-;/)2."
This problem statement requests implementation of an operator selection pattern where:
operator(s) Op from a set (e.g., {+, -, /})The functionality requested by this problem statement was already fully implemented in the Starlog-in-Prolog library before this PR. This PR adds documentation and examples to make this capability more discoverable.
The pattern is supported through standard Prolog's arithmetic evaluation (is/2) combined with:
% Find operator where 3 = 1 Op 2 ?- findall(Op, (member(Op, [+, -, /]), Expr =.. [Op, 1, 2], 3 is Expr), Ops). Ops = [+]. % Find value where 3 = 1 + A ?- findall(A, (member(A, [1, 2, 3]), 3 is 1+A), As). As = [2].
demo_operator_selection.pl with 4 comprehensive examplesThe problem statement included 4 related patterns, all of which are implemented:
→ A = [2], B = [1]` → Op = +`3 is 1+(A is 1;2;3) - Value selection (Requirement 3)
3 = 1 + A → A = 2A is (B is 1)+B - Nested is expressions (Requirement 4)
B = 1, A = B + B → B = 1, A = 2All tests passing:
=== Requirement 2: Operator Selection === Req 2.1: Operator selection - find Op where 3 is 1 Op 2... ✓ (Op = +) Req 2.2: Multiple valid operators - find Op where 6 is 2 Op 3... ✓ (Ops = [*])
The problem statement "Complete 3 is 1(A is +;-;/)2." is fully addressed. The functionality was already implemented and tested; this PR adds documentation and examples to make it easier for users to discover and use this capability.