On Fri, May 17, 2019 at 5:44 PM Victor Khomenko
<victor.khomenko(a)newcastle.ac.uk> wrote:
While you are at this, maybe you could also implement
SVA's ##[*] and ##[+] (as sugar for ##[0:$] and ##[1:$]) for completeness?
Yes I can. I have seen those operators on a couple of presentations
online, but could not find any mention of them in the language
reference manual.
Please also note that the equality a ##[i:j] b =
a:([*i:j];b) is wrong (despite being recommended in some textbooks!), e.g.
Ouch.
So currently, assuming j>0, I use these rules
a ##[i:j] b = a;[*i-1:j-1];b if i > 0
a ##[0:j] b = a:([*0:j];b) // wrong if a accepts [*0]
Do you agree with the following replacement?
a ##[i:j] b = a;[*i-1:j-1];b if i > 0
a ##[0:j] b = a:([*0:j];b) if a rejects [*0]
a ##[0:j] b = (a;[*0:j]):b if a accepts [*0] but b rejects [*0]
a ##[0:j] b = (a:b) | (a;[*0:j-1];b) if a and b both reject [*0]
The goal is just to avoid duplicating a and b when possible.
--
Alexandre Duret-Lutz