Integer division only please.

This commit is contained in:
Simon Forman 2021-04-09 17:04:54 -07:00
parent 8c65046420
commit fbdd79a8db
1 changed files with 6 additions and 4 deletions

View File

@ -70,8 +70,7 @@ ALIASES = (
('and', ['&']), ('and', ['&']),
('bool', ['truthy']), ('bool', ['truthy']),
('mul', ['*']), ('mul', ['*']),
('floordiv', ['/floor', '//']), ('floordiv', ['/floor', '//', '/', 'div']),
('truediv', ['/', 'div']),
('mod', ['%', 'rem', 'remainder', 'modulus']), ('mod', ['%', 'rem', 'remainder', 'modulus']),
('eq', ['=']), ('eq', ['=']),
('ge', ['>=']), ('ge', ['>=']),
@ -1165,7 +1164,10 @@ def dip(stack, expression, dictionary):
... Q x ... Q x
''' '''
(quote, (x, stack)) = stack try:
(quote, (x, stack)) = stack
except ValueError:
raise StackUnderflowError
expression = (x, expression) expression = (x, expression)
return stack, concat(quote, expression), dictionary return stack, concat(quote, expression), dictionary
@ -1425,7 +1427,7 @@ for F in (
BinaryBuiltinWrapper(operator.mul), BinaryBuiltinWrapper(operator.mul),
BinaryBuiltinWrapper(operator.pow), BinaryBuiltinWrapper(operator.pow),
BinaryBuiltinWrapper(operator.sub), BinaryBuiltinWrapper(operator.sub),
BinaryBuiltinWrapper(operator.truediv), ## BinaryBuiltinWrapper(operator.truediv),
UnaryBuiltinWrapper(bool), UnaryBuiltinWrapper(bool),
UnaryBuiltinWrapper(operator.not_), UnaryBuiltinWrapper(operator.not_),