sardine icon indicating copy to clipboard operation
sardine copied to clipboard

uppercase Amphibian Variables fail within patterns

Open HighHarmonics2 opened this issue 1 year ago • 1 comments

V.x works within pattern language. V.X fails within pattern language. V.X works outside of pattern language. error: ValueError: Cannot pattern an empty sequence: []

To reproduce:

V.X, V.Y, V.W, V.z = ['cp:1', 0.335, 0.556, 0.2]
# fails with empty pattern
@swim
def testAV(p=1, i=0):
    D('(v X)', begin=V.Y, end=V.W, i=i)
    again(testAV, p=P('(v z)', i), i=i+1)

# succeeds
# note that 1st amph Var is now lower case
V.x, V.Y, V.W, V.z = ['cp:1', 0.335, 0.556, 0.2]

@swim
def testAV(p=1, i=0):
    D('(v x)', begin=V.Y, end=V.W, i=i)
    again(testAV, p=P('(v z)', i), i=i+1)

This is a minor problem. It just means that within patterns, amphibian variables must be lower case.

HighHarmonics2 avatar Apr 09 '23 03:04 HighHarmonics2

Yes, unfortunately there is not much I can do about it now but I will have to revise that part of the code sooner or later. Will keep it in mind for the next time I'll dive into that bit.

Bubobubobubobubo avatar Apr 10 '23 20:04 Bubobubobubobubo