Article about Photomath and its own functional programming language

38 views
Skip to first unread message

S.Y. Lee

unread,
Feb 8, 2023, 8:02:44 AM2/8/23
to sympy
I have read about the article about how Photomath is developing their own functional programming language in its step-by-step solver

https://medium.com/photomath-engineering/advantages-of-using-functional-programming-in-photomath-step-by-step-solutions-e3909f899871

Unfortunately, the article is not that much detailed about its technical details,
But I get the glimpse of the idea that 'immutability' and 'pure function' is important in computer algebra system.
And they point out that the problem about python (and maybe sympy) is, that python is designed to be very 'dynamic' language, and if you program everything semantically 'immutable' and 'pure', the python interpreter won't recognize that and can't optimize the functional program written with it because CPython assumes that your program is 'dynamic'.

So they chose to develop their own functional DSL in C++. I'm not sure how designing a DSL is useful for computer algebra systems despite it can give freedom to choose syntax as convenient as possible, but the optimization part is interesting for why true functional proramming language is needed.

Francesco Bonazzi

unread,
Feb 9, 2023, 4:37:13 PM2/9/23
to sympy
Note that there is a very powerful library to implement mathematical rules in Python that uses its own syntax: MatchPy

We do have a way to connect SymPy to MatchPy.

We also have an experimental compiler for MatchPy rules that generates C++ decision trees.
Reply all
Reply to author
Forward
0 new messages