source: git/old_modgen/openmathserver/CD/arith1.py @ c36fda

spielwiese
Last change on this file since c36fda was c36fda, checked in by Oleksandr Motsak <motsak@…>, 10 years ago
Moved all the outdated modgen related stuff to /old_modgen/ for now
  • Property mode set to 100644
File size: 597 bytes
Line 
1"Implementation of arith1 content dictionary"
2from objects import OMSymbol
3from cd import OMCD, OMCDImplementation
4#from omexceptions import *
5
6content = OMCD("arith1")
7implementation = OMCDImplementation(content)
8
9plussym = OMSymbol("plus", content)
10
11def plusfunc(context, *args):
12    "tries, convert to generic and adding"
13    args = [context.toGeneric(omobj) for omobj in args]
14    if len(args) == 0:
15        return content.package(0)
16    else:
17        erg = args[0]
18        for i in xrange(1, len(args)):
19            erg = erg+args[i]
20    return erg
21implementation.implement("plus", plusfunc)
Note: See TracBrowser for help on using the repository browser.