TextJoyType and inscribe command.
I took the plunge and added the meta-command "inscribe" to the library. This is, of course, a very dangerous and powerful command. Use it wisely.
This commit is contained in:
@@ -279,6 +279,24 @@ for name, primitive in getmembers(genlib, isfunction):
|
||||
inscribe(SimpleFunctionWrapper(primitive))
|
||||
|
||||
|
||||
@inscribe
|
||||
@FunctionWrapper
|
||||
def inscribe_(stack, expression, dictionary):
|
||||
'''
|
||||
Create a new Joy function definition in the Joy dictionary. A
|
||||
definition is given as a string with a name followed by a double
|
||||
equal sign then one or more Joy functions, the body. for example:
|
||||
|
||||
sqr == dup mul
|
||||
|
||||
If you want the definition to persist over restarts, enter it into
|
||||
the definitions.txt resource.
|
||||
'''
|
||||
definition, stack = stack
|
||||
DefinitionWrapper.add_def(definition, dictionary)
|
||||
return stack, expression, dictionary
|
||||
|
||||
|
||||
@inscribe
|
||||
@SimpleFunctionWrapper
|
||||
def parse(stack):
|
||||
|
||||
Reference in New Issue
Block a user