phylanx
phylanx copied to clipboard
Append is broken.
from phylanx import Phylanx
@Phylanx(debug=1)
def test_append():
a = []
append(a, 1)
return a
print(test_append())
expecting [1], getting []:
define(
test_append,
lambda(
block(
define(
a,
list()
),
append(a, 1),
a
)
)
)
[]
@rtohid I think the problem is that PhySL objects are never changed in-place. The following should work as expected:
from phylanx import Phylanx
@Phylanx
def test_append():
a = []
a = append(a, 1)
return a
print(test_append())
I'm not sure whether we should do the corresponding transformations in the frontend (i.e. transforming append(a, 1) into a = append(a, 1)). What do you say?