eyereasoner / eye

Euler Yet another proof Engine
https://eyereasoner.github.io/eye/
MIT License
124 stars 17 forks source link

string:replace #101

Closed bdevloed closed 11 months ago

bdevloed commented 11 months ago

string:replace seems to behave incorrectly when using a """^pattern""".

So, for the test below. I would expect :test :result "XA", "BA". instead of :test :result "XX", "BA".

PREFIX : <urn:example:>
PREFIX string: <http://www.w3.org/2000/10/swap/string#>

:Let :params
  "AA",
  "BA".

{
  :Let :params ?X.

  ( ?X "^A"  "X" ) string:replace ?result.
} => {
  :test :result ?result.
}.
eye --nope --pass test.n3
EYE v8.6.19 (2023-11-24)
SWI-Prolog version 9.1.19
starting 65 [msec cputime] 57 [msec walltime]
# Processed by EYE v8.6.19 (2023-11-24)
# eye --nope --pass test.n3

GET file:///xxx/test.n3 SC=3
networking 3 [msec cputime] 3 [msec walltime]
@prefix : <urn:example:>.

:Let :params "AA".
:Let :params "BA".
:test :result "XX".
:test :result "BA".
reasoning 1 [msec cputime] 1 [msec walltime]
# 2023-11-24T15:13:49.473Z in=3 out=4 ent=2 step=4 brake=2 inf=25307 sec=0.070 inf/sec=361529
# ENDS

2023-11-24T15:13:49.473Z in=3 out=4 ent=2 step=4 brake=2 inf=25307 sec=0.070 inf/sec=361529
josd commented 11 months ago

Now you should get

eye --nope --pass test.n3
EYE v8.7.5 (2023-11-29)
SWI-Prolog version 9.1.19-24-g17913c0c9
starting 37 [msec cputime] 33 [msec walltime]
# Processed by EYE v8.7.5 (2023-11-29)
# eye --nope --pass test.n3

GET file:///tmp/test.n3 SC=3
networking 2 [msec cputime] 1 [msec walltime]
@prefix : <urn:example:>.

:Let :params "AA".
:Let :params "BA".
:test :result "XA".
:test :result "BA".
reasoning 2 [msec cputime] 1 [msec walltime]
# 2023-11-29T18:49:41.256Z in=3 out=4 ent=2 step=4 brake=2 inf=23305 sec=0.041 inf/sec=568415
# ENDS

2023-11-29T18:49:41.256Z in=3 out=4 ent=2 step=4 brake=2 inf=23305 sec=0.041 inf/sec=568415

Thanks for the observation.