[Edu-sig] a draft module (funky.py) -- digital math track
kirby urner
kirby.urner at gmail.com
Wed Oct 13 23:42:06 CEST 2010
"""
non-axial: 10 FF + 2 is the classic CCP number
sequence (OEIS A005901).
Here we bring out the +2 associated with polar
vertexes by means of function composition, applied
using decorator syntax (@)
[12, 42, 92, 162, 252, 362, 492, 642, 812, 1002]
Note how a "double decorator" makes sense
as well (the output function is fed back in
to compose and output once again ala g(g(f(x)).
[4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
brainstorming posters for Pycon / Havana; Pycon / Ukraine
by 4dsolutions.net
Bibliography:
The King of Infinite Space (bio of HSM Coxeter)
Proof of 10FF + 2 (NCLB project)
Xtals 101 (4dsolutions.net/ocn/xtals101.html)
"""
def compose( f ):
global g
return lambda x: g( f (x) )
def g(x): return x + 2
@compose
def nonaxial(n): return 10 * n * n
@compose
@compose
def identity(x): return x
def test():
print ( [ nonaxial(x) for x in range(1, 11) ] )
print ( [ identity(x) for x in range(10) ] )
if __name__ == "__main__":
test()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/edu-sig/attachments/20101013/0e9e0617/attachment.html>
More information about the Edu-sig
mailing list