mathics3 / mathics-development-guide Goto Github PK
View Code? Open in Web Editor NEWSphinx documention for developing Mathics3
Home Page: https://mathics-development-guide.readthedocs.io/en/latest/
Sphinx documention for developing Mathics3
Home Page: https://mathics-development-guide.readthedocs.io/en/latest/
Hi, I am new to mathics. When reading the document of how to extend mathics, I found the description of usage of Builtin
and Predefined
maybe incorrect.
In chapter of evaluation.rst, it says
Functions which take no parameters are generally subclassed off of the Builtin class.
However when a function takes parameters it method’s Object class is derived either directly indirectly from the Predefined class rather than the Builtin. To figure out which apply method in the class object to call, each method’s document string (or docstring) is consulted. The lookup process is kicked off using the evaluate() method found in the Predefined class.
And when I contiue to read the document of Hello, World! – using Predefined
and Introducing the Builtin Class
also with the source code of Builtin
and Predefined
class, I found the description above is quite opposite.
In calling-mathics-library-from-within-python-code, section Mathics3 Results as Python Objects
It seems that the example code should be:
# This is the same as before
from mathics.session import MathicsSession
session = MathicsSession(catch_interrupt=True)
# These are Mathics3 classes we are going to use.
from mathics.core.expression import Expression, Integer
from mathics.core.systemsymbols import SymbolFactorial
# Compute 20!
x = Expression(SymbolFactorial, Integer(10)
).evaluate(session.evaluation).to_python()
print(x) # 2432902008176640000
and
# This is the same as before
from mathics.session import MathicsSession
session = MathicsSession(catch_interrupt=True)
# These are Mathics3 classes we are going to use.
from mathics.core.expression import Expression, Integer
from mathics.core.symbols import SymbolPlus, SymbolTimes
# Compute 5 * (6 + 3)
x = Expression(SymbolTimes, Integer(5),
Expression(SymbolPlus, Integer(6), Integer(3))
).evaluate(session.evaluation).to_python()
print(x) # 45
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.