assertEqualToResult gives the same result for correct and incorrect pattern in dasgate example
Closed this issue · 3 comments
CICS-Oleg commented
Let's consider the following metta script:
!(import! &self das_gate)
!(bind! &das (new-das))
!(add-atom &das (Test (Test 2)))
!(add-atom &das (Best (Test 2)))
!(add-atom &das Test)
; option 1: 2-nd argument is what we expect from incorrectly working match. This test should be passed, but the program fails here
!(assertEqualToResult
(match &das (Test $v2) (This $v2 works))
((This 2 works) (This (Test 2) works) (This 2 works)))
; option 2: 2-nd argument is what we expect from correctly working match. This test should be failed, and the program fails here
!(assertEqualToResult
(match &das (Test $v2) (This $v2 works))
((This 2 works) (This (Test 2) works)))
The question is: why does program fail in option 1?
Necr0x0Der commented
First of all, we don't expect (This 2 works)
as a result. It is just. wrong. We expect only top-level results for match
. We may have a special function in das-gate to query all the matches, but it should be distinguished from match
in space API.
As for your problem, its core cause is that das gate returns 2
not as a grounded object, but as a symbol. The question is what to do with it, but you can replace 2
with A
for now, and it will work.
vsbogd commented
@CICS-Oleg is your question resolved?