I was wondering if anyone knew of any programming languages that only allowed iteration and not recursion, and of any programming languages that allow only recursion and not iteration.

Printable View

- 10-07-2005webrenLanguages - Recursion/Iteration
I was wondering if anyone knew of any programming languages that only allowed iteration and not recursion, and of any programming languages that allow only recursion and not iteration.

- 10-08-2005Rashakil Fol
Iteration can be expressed using tail recursion, and recursion can be expressed iteratively. Haskell doesn't have iteration built-in to the standard, but you can still define iterative-looking functions. For example, map and foldl are defined recursively in the standard.

In some languages that arguably have iterative constructs, you could use a macro to define the iterative construct recursively. If that built-in iterative construct were removed from the language, it could still be built, but does that mean the language is said to allow iteration? Would the answer change if the language's standard mandated tail-call optimisation?

Any programming language that doesn't have subroutines or functions doesn't allow recursion. - 10-10-2005ober
I'm not quite sure why you would want to limit yourself one way or another. Can you explain why you're making such a request?

- 10-10-2005webren
I finished studying recursion and was wondering. I definitely wouldn't limit myself to one or the other, but I was curious.

Thanks for the replies.