~aesthete-team/aesthete/bush

« back to all changes in this revision

Viewing changes to aesthete/glypher/Commands.py

  • Committer: Phil Weir
  • Date: 2012-09-10 06:48:44 UTC
  • Revision ID: phil.t.weir@googlemail.com-20120910064844-no03zy0z0n0t578j
glypher: couple of GTK-3 bug fixes and insertion of sourced equations

Show diffs side-by-side

added added

removed removed

Lines of Context:
169
169
                return GlypherSpaceArray(None, lhs=make_word('Defined', None), rhs=lhs.copy())
170
170
 
171
171
            if rhs.am('function') :
172
 
                func_sym = rhs['name'].get_sympy()
 
172
                func_sym = rhs['function'].get_sympy()
173
173
                if func_sym != lhs_sym :
174
174
                    return "Expect function name to match declared function"
175
175
 
183
183
                g.register_variable(g.VAR_DEF_FUN, func_sym, rhs.get_sympy_args())
184
184
 
185
185
                return GlypherSpaceArray(None, lhs=make_word('Defined', None),
186
 
                                         rhs=rhs['name'].get_entities()[0].copy())
 
186
                                         rhs=rhs['function'].get_entities()[0].copy())
187
187
 
188
188
        if lhs.am('function') :
189
 
            func_sym = lhs['name'].get_sympy()
 
189
            func_sym = lhs['function'].get_sympy()
190
190
            if not isinstance(func_sym, Dynamic.Symbol) :
191
191
                return "Function name not a sympy symbol (usu. a GlypherWord or subscripted Word)"
192
192
 
194
194
                if not isinstance(arg.get_sympy(), Dynamic.Symbol) :
195
195
                    return "All arguments should give Sympy symbols"
196
196
 
197
 
            g.register_variable(g.VAR_LET_FUN, lhs['name'].get_sympy(),
 
197
            g.register_variable(g.VAR_LET_FUN, lhs['function'].get_sympy(),
198
198
                Dynamic.Lambda(lhs.get_sympy_args(), rhs.get_sympy()))
199
199
            return GlypherSpaceArray(None, lhs=make_word('Defined', None), rhs=lhs.copy())
200
200
 
268
268
    func = args[0]
269
269
 
270
270
    if func.am('function') :
271
 
        func_sym = func['name'].get_sympy()
 
271
        func_sym = func['function'].get_sympy()
272
272
        if not isinstance(func_sym, Dynamic.Symbol) :
273
273
            return "Function name not a sympy symbol (usu. a GlypherWord or subscripted Word)"
274
274
 
279
279
        g.define_functions[func_sym.get_sympy()] = func.get_sympy_args()
280
280
 
281
281
        return GlypherSpaceArray(None, lhs=make_word('Defined', None),
282
 
                                 rhs=func['name'].get_entities()[0].copy())
 
282
                                 rhs=func['function'].get_entities()[0].copy())
283
283
 
284
284
    return "Did not fit a known Define format"
285
285