Practical numbers: Difference between revisions
→Composition of pure functions: Explained the semantic type of the central function, which is concealed by the compiler hint.
(→Composition of pure functions: Explained the semantic type of the central function, which is concealed by the compiler hint.) |
|||
Line 254:
range(1, n)
))
# The real underlying type of this function happens to be
# more concealed than revealed by the compiler type hint.
#
# It actually returns a Bool, and its second argument
# is an Int.
#
# The follow comment on type semantics was orginally attached,
# but was angrily removed by a serial "discourager" of
# rival approaches :-)
#
# sumOfAnySubset :: [Int] -> Int -> Bool
Line 369 ⟶ 381:
def until(p: bool) -> Any:
'''The result of repeatedly applying f until p holds.
The initial seed value is x.
Line 403 ⟶ 415:
# MAIN ---
if __name__ == '__main__':
main()
</lang>
{{Out}}
|