Thread: Languages - Recursion/Iteration

  1. #1
    Registered User
    Join Date
    Apr 2005

    Languages - 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.

  2. #2
    Join Date
    Jul 2005
    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.

  3. #3
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    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?
    EntropySink. You know you have to click it.

  4. #4
    Registered User
    Join Date
    Apr 2005
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why C Matters
    By DavidP in forum A Brief History of
    Replies: 136
    Last Post: 01-16-2008, 09:09 AM
  2. Strange loop
    By D@rk_force in forum C++ Programming
    Replies: 22
    Last Post: 12-18-2004, 02:40 PM
  3. Languages dying
    By Zewu in forum A Brief History of
    Replies: 31
    Last Post: 07-29-2003, 10:08 AM
  4. Languages
    By KrAzY CrAb in forum A Brief History of
    Replies: 23
    Last Post: 02-18-2003, 12:23 PM
  5. Programming Languages
    By DarkViper in forum A Brief History of
    Replies: 3
    Last Post: 12-12-2002, 02:28 PM