We don't need floor if we have only ints.

Id is too easy as a definition.

divmod is cool.
This commit is contained in:
Simon Forman
2022-09-12 16:38:14 -07:00
parent 1e3b2f76bb
commit aad2da35cf
2 changed files with 23 additions and 28 deletions
-27
View File
@@ -7,33 +7,6 @@ ALIASES = (
('id', [u'']),
)
def floor(n):
return int(math.floor(n))
floor.__doc__ = math.floor.__doc__
@inscribe
@SimpleFunctionWrapper
def divmod_(S):
'''
divmod(x, y) -> (quotient, remainder)
Return the tuple (x//y, x%y). Invariant: q * y + r == x.
'''
y, (x, stack) = S
q, r = divmod(x, y)
return r, (q, stack)
@inscribe
@SimpleFunctionWrapper
def id_(stack):
'''The identity function.'''
return stack
#
# § Combinators
#