Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #51674 > unrolled thread
| Started by | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| First post | 2013-07-31 11:07 -0600 |
| Last post | 2013-07-31 11:07 -0600 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Lambda function Turing completeness Ian Kelly <ian.g.kelly@gmail.com> - 2013-07-31 11:07 -0600
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2013-07-31 11:07 -0600 |
| Subject | Re: Lambda function Turing completeness |
| Message-ID | <mailman.40.1375290509.1251.python-list@python.org> |
On Wed, Jul 31, 2013 at 12:53 AM, Musical Notation <musicdenotation@gmail.com> wrote: > Is it possible to write a Turing-complete lambda function (which does not depend on named functions) in Python? Yes, lambda functions are Turing-complete. You can get anonymous recursion by defining the function to take a recursive function argument and then passing it to itself. For example, this will (inefficiently) give you the 13th Fibonacci number: (lambda f, n: f(f, n))(lambda f, n: n if n < 2 else f(f, n-2) + f(f, n-1), 13)
Back to top | Article view | comp.lang.python
csiph-web