What are practical guidelines for evaluating a language's “Turing Completeness”?

前端 未结 13 2266
礼貌的吻别
礼貌的吻别 2020-12-22 19:22

I\'ve read \"what-is-turing-complete\" and the wikipedia page, but I\'m less interested in a formal proof than in the practical implications of being Turing Complete.

<
13条回答
  •  不思量自难忘°
    2020-12-22 19:57

    You need some form of dynamic allocation construct (malloc ornew or cons will do) and either recursive functions or some other way of writing an infinite loop. If you have those and can do anything at all interesting, you're almost certainly Turing-complete.

    The lambda calculus is equivalent in power to a Turing machine, and if you implement lambda calculus it is actually pretty fun writing lambda calculus programs. Way more fun than writing program for a Turing machine!

    The only practical implication of Turing-completeness I'm aware of is that you can write programs that don't terminate. I've used a couple of special-purpose languages that guarantee termination and therefore are not Turing-complete. Sometimes it is useful to give up the extra expressive power in exchange for guaranteed termination.

提交回复
热议问题