source: git/modules/openmathserver/arith1.py @ e93f7b

spielwiese
Last change on this file since e93f7b was e93f7b, checked in by Michael Brickenstein <bricken@…>, 18 years ago
*bricken: beautified git-svn-id: file:///usr/local/Singular/svn/trunk@8397 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 914 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    #print "plusfunc", args
14    args = [context.toGeneric(omobj) for omobj in args]
15    if len(args) == 0:
16        return content.package(0)
17    else:
18        erg = args[0]
19        for i in xrange(1, len(args)):
20            erg = erg+args[i]
21    return erg
22implementation.implement("plus", plusfunc)
23#print implementation[sym]
24#print plussym
25#print sym==plussym
26#print implementation[plussym]
27#plusimpl=ImplementedOMSymbol(plussym,plusfunc)
28#implementation[plussym]=plusimpl
29#print "Laenge", (len(implementation.implementations))
30#assert OMSymbol("plus",content)==OMSymbol("plus",content)
Note: See TracBrowser for help on using the repository browser.