| Did you know ... | Search Documentation: |
| Pack starlog -- ALL_COMBINATIONS_CONFIGURATIONS.md |
Implement all combinations and configurations of: A is (1:1 >> string_number) * (+(1,1))
This implementation demonstrates comprehensive support for combining Starlog's key features:
: operator>> operatorA is (1:1 >> string_number) * (+(1,1)) showcases how these features work seamlessly together.A is (1:1 >> string_number) * (+(1,1))This expression evaluates as follows:
1:1 - String concatenation
"11" (string)"11" to number 11+(1,1) - Arithmetic function notation
211 * 222?- starlog_call(A is 1:1). A = "11". ?- starlog_call(A is 2:3). A = "23". ?- starlog_call(A is 1:2:3). A = "123".
?- starlog_call(A is 1:1 >> string_number). A = 11. ?- starlog_call(A is 1:1 >> string_length). A = 2. ?- starlog_call(A is [1:1] >> reverse >> length). A = 1.
?- starlog_call(A is (1:1 >> string_number) + (+(1,1))). A = 13. % 11 + 2
?- starlog_call(A is (1:1 >> string_number) - (+(1,1))). A = 9. % 11 - 2
?- starlog_call(A is (1:1 >> string_number) * (+(1,1))). A = 22. % 11 * 2
?- starlog_call(A is (2:2 >> string_number) / (+(1,1))). A = 11. % 22 / 2
?- starlog_call(A is (2:3 >> string_number) // (+(2,2))). A = 5. % 23 // 4
?- starlog_call(A is (2:3 >> string_number) mod (+(3,2))). A = 3. % 23 mod 5
?- starlog_call(A is (2:0 >> string_number) ** (+(1,1))). A = 400. % 20 ** 2 ?- starlog_call(A is (3:0 >> string_number) ^ (+(1,1))). A = 900. % 30 ^ 2
?- starlog_call(A is (2:3 >> string_number) * (+(1,1))). A = 46. % "23" -> 23 * 2 ?- starlog_call(A is (4:5 >> string_number) * (+(2,2))). A = 180. % "45" -> 45 * 4 ?- starlog_call(A is (1:2:3 >> string_number) * (+(1,1))). A = 246. % "123" -> 123 * 2
?- starlog_call(A is ((1:1) : (2:2) >> string_number) * 2). A = 2244. % "1122" -> 1122 * 2
?- starlog_call(A is (1:1 >> string_number) * (+(1,1) + +(1,1))). A = 44. % 11 * (2 + 2)
?- starlog_call(A is ((1:2 >> string_number) + (3:4 >> string_number)) * (+(1,1))). A = 92. % (12 + 34) * 2
?- starlog_call(A is ((1:1 >> string_number) * 2) + ((2:2 >> string_number) * 2)). A = 66. % (11 * 2) + (22 * 2) = 22 + 44
?- starlog_call(A is (a•b >> atom_length) * (+(1,1))). A = 4. % ab has length 2, 2 * 2 = 4
?- starlog_call(A is (0:0 >> string_number) * (+(1,1))). A = 0. % "00" -> 0 * 2 ?- starlog_call(A is (1:1 >> string_number) * (+(0,0))). A = 0. % 11 * 0
?- starlog_call(A is (1:1 >> string_number) * (+(0,-1))). A = -11. % 11 * (-1)
?- starlog_call(A is (5 >> number_string) >> string_number). A = 5. % 5 -> "5" -> 5
This pattern demonstrates the seamless integration of:
:)•)&)>>+, -, *, /, //, mod, **, ^+(A,B), *(A,B), etc.tests/test_all_combinations_configurations.plComprehensive test suite with 40+ tests covering:
demo_all_combinations_configurations.plInteractive demonstration showing:
ALL_COMBINATIONS_CONFIGURATIONS.mdThis documentation file explaining:
?- use_module(starlog). ?- starlog_call(A is (1:1 >> string_number) * (+(1,1))). A = 22.
% Step 1: String concatenation ?- starlog_call(A is 1:1). A = "11". % Step 2: Method chaining ?- starlog_call(A is 1:1 >> string_number). A = 11. % Step 3: Complete expression ?- starlog_call(A is (1:1 >> string_number) * (+(1,1))). A = 22.
% Multiple method chains ?- starlog_call(A is (1:1 >> string_number >> number_string) : "x"). A = "11x". % Complex nested expression ?- starlog_call(A is ((1:2 >> string_number) + (3:4 >> string_number)) * (+(1,1))). A = 92.
Run the test suite:
swipl -s tests/test_all_combinations_configurations.pl
Run the demonstration:
swipl -s demo_all_combinations_configurations.pl
This feature is fully compatible with:
The pattern A is (1:1 >> string_number) * (+(1,1)) demonstrates that Starlog supports:
✓ All combinations of operators (:, •, &)
✓ All configurations of method chaining (>>)
✓ All arithmetic operations (+, -, *, /, //, mod, **, ^)
✓ All type conversions (string_number, number_string, etc.)
✓ Nested expressions of arbitrary depth
✓ Mixed operator types in single expressions
✓ Edge cases (zero, negative, conversions)
The implementation is complete, tested, and documented. All 40+ test cases pass successfully.