Changeset 1667822 in git


Ignore:
Timestamp:
Jun 15, 2005, 1:50:16 PM (18 years ago)
Author:
Michael Brickenstein <bricken@…>
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
01cd17fd67cfda8867350bb5007624dde10be224
Parents:
04f6a4e219c5180c44ff638afd7e63cc8ffa3699
Message:
*bricken: refactoring


git-svn-id: file:///usr/local/Singular/svn/trunk@8370 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
modules/openmathserver
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • modules/openmathserver/arith1.py

    r04f6a4 r1667822  
    88implementation=OMcdImplementation(content)
    99
    10 plussym=OMsymbol("plus",content)
     10plussym=OMSymbol("plus",content)
    1111
    1212def plusfunc(context, *args):
     
    2525#print sym==plussym
    2626#print implementation[plussym]
    27 #plusimpl=ImplementedOMsymbol(plussym,plusfunc)
     27#plusimpl=ImplementedOMSymbol(plussym,plusfunc)
    2828#implementation[plussym]=plusimpl
    2929#print "Laenge", (len(implementation.implementations))
    30 #assert OMsymbol("plus",content)==OMsymbol("plus",content)
     30#assert OMSymbol("plus",content)==OMSymbol("plus",content)
  • modules/openmathserver/binding.py

    r04f6a4 r1667822  
    1 from objects import OMObjectBase, OMsymbol
     1from objects import OMObjectBase, OMSymbol
    22from cd import *
    33from omexceptions import *
     
    55from copy import copy
    66cdFns1=OMcd("fns1")
    7 lambdasym=OMsymbol("lambda",cdFns1)
     7lambdasym=OMSymbol("lambda",cdFns1)
    88
    99def islambda(sym):
  • modules/openmathserver/cd.py

    r04f6a4 r1667822  
    1 from objects import OMsymbol
     1from objects import OMSymbol
    22from omexceptions import *
    33class OMcd(object):
     
    2222        self.implementations[name]=value
    2323    def implement(self,symbolname, func):
    24         symbol=OMsymbol(symbolname,self.cd)
    25         impl=ImplementedOMsymbol(symbol,func)
     24        symbol=OMSymbol(symbolname,self.cd)
     25        impl=ImplementedOMSymbol(symbol,func)
    2626        self[symbol]=impl
    2727       
    2828
    2929
    30 class ImplementedOMsymbol(OMsymbol):
     30class ImplementedOMSymbol(OMSymbol):
    3131    def __init__(self,symbol, func):
    32         super(ImplementedOMsymbol,self).__init__(symbol.name, symbol.cd)
     32        super(ImplementedOMSymbol,self).__init__(symbol.name, symbol.cd)
    3333        self.implementation=func
    3434    def __str__(self):
  • modules/openmathserver/objects.py

    r04f6a4 r1667822  
    105105        closing="".join(["</"+self.XMLtag+">"])
    106106        return "".join([opening,body,closing])
    107 class OMvar(OMObjectBase):
     107class OMVar(OMObjectBase):
    108108    def __init__(self,name):
    109         super(OMvar,self).__init__()
     109        super(OMVar,self).__init__()
    110110        self.name=name
    111111    def evaluate(self,context):
     
    142142        raise UnsupportedOperationError
    143143       
    144 class OMsymbol(OMObjectBase):
     144class OMSymbol(OMObjectBase):
    145145    def __init__(self,name,cd=None):
    146         super(OMsymbol,self).__init__()
     146        super(OMSymbol,self).__init__()
    147147        self.cd=cd
    148148        self.name=name
     
    206206    def getXMLattributes(self):
    207207        return [XMLattribute("dec",str(self.value))]
    208 class OMref(OMObjectBase):
     208class OMRef(OMObjectBase):
    209209    def __init__(self, ref):
    210210        self.ref=ref
     
    225225    context["x"]=OMint(1)
    226226
    227     x=OMvar("x")
    228 
    229     y=OMvar("y")
     227    x=OMVar("x")
     228
     229    y=OMVar("y")
    230230
    231231    print context.evaluate(x)
    232232    print context.evaluate(y)
    233     firstArg=OMbinding(lambdasym,[OMvar("x"), OMvar("y")], OMvar("x"))
     233    firstArg=OMbinding(lambdasym,[OMVar("x"), OMVar("y")], OMVar("x"))
    234234    #print context.evaluate(firstArg)
    235235    application=OMapplication(firstArg, [x,y])
     
    242242    #application=OMapplication(arith1.plussym,[x])
    243243    #application=OMapplication(arith1.plussym,[x,x])
    244     application=OMapplication(OMsymbol("plus",arith1.content),[x,x])
     244    application=OMapplication(OMSymbol("plus",arith1.content),[x,x])
    245245   
    246246    print context.evaluate(application)
    247     application=OMapplication(OMsymbol("plus",arith1.content),[x,x,x])
     247    application=OMapplication(OMSymbol("plus",arith1.content),[x,x,x])
    248248   
    249249    print context.evaluate(application)
Note: See TracChangeset for help on using the changeset viewer.