lcompilers / lpython

Python compiler
https://lpython.org/
Other
1.37k stars 156 forks source link

Added support for subs attribute #2695

Closed anutosh491 closed 1 month ago

anutosh491 commented 1 month ago

This allows us to address the following case

from lpython import S
from sympy import Symbol, sin

def main0():
    x: S = Symbol('x')
    y: S = Symbol('y')
    z: S = sin(x)
    s: S = z.subs(x, y)
    print(s)

main0()
(lf) anutosh491@spbhat68:~/lpython/lpython$ lpython --enable-symengine examples/expr2.py 
sin(y)
(lf) anutosh491@spbhat68:~/lpython/lpython$ lpython --enable-symengine examples/expr2.py --backend=c
sin(y)