GithubHelp home page GithubHelp logo

mathics3 / mathics-development-guide Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 2.0 1.32 MB

Sphinx documention for developing Mathics3

Home Page: https://mathics-development-guide.readthedocs.io/en/latest/

Makefile 10.03% Python 89.97%

mathics-development-guide's People

Contributors

cherryblossom000 avatar garkgarcia avatar li-xiang-ideal avatar mmatera avatar rocky avatar tiagocavalcante avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mathics-development-guide's Issues

The description of usage of `Builtin` and `Predefined` class in <Evaluation of an Expression> is incorrect?

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.

https://github.com/Mathics3/mathics-development-guide/blob/6b5e3c92089eeed69528ba005afe04e5a4ae94d0/docs/extending/developing-code/code-overview/evaluation.rst

Document calling-mathics-library-from-within-python-code out of date

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.