Jump to content

Padovan n-step number sequences: Difference between revisions

m
→‎Python: Functional: Expanded preamble, explicitly excluded negative values of N.
(→‎{{header|AppleScript}}: Negative values of N explicitly excluded.)
m (→‎Python: Functional: Expanded preamble, explicitly excluded negative values of N.)
Line 1,001:
===Python: Functional===
 
Defined in terms of a generic anamorphism, using the unfold abstraction, which is dual to reduce.
 
Aims for a legible expression of the Padovan recurrence relation, a good level of reliability and code reuse, and for rapid drafting and refactoring.
 
Functional composition, while widely practiced and written about in the context of Python, is not the dominant Python tradition. The documentation of the Python itertools module does, however, acknowledges its debt to languages like ML and Haskell, both for an algebra of composition, and for a source of function-naming traditions.
 
This draft is thoroughly linted, for a high degree of compliance with Python language standards and layout.
 
<lang python>'''Padovan N-step series'''
9,655

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.