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:
Simon Forman
2018-07-17 10:35:11 -07:00
parent d9d52fa224
commit 0029656351
2 changed files with 25 additions and 0 deletions
+18
View File
@@ -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):