Languages - Recursion/Iteration

This is a discussion on Languages - Recursion/Iteration within the Tech Board forums, part of the Community Boards category; I was wondering if anyone knew of any programming languages that only allowed iteration and not recursion, and of any ...

  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    36

    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
    aoeuhtns
    Join Date
    Jul 2005
    Posts
    581
    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
    Posts
    4,429
    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
    Posts
    36
    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 Cprogramming.com
    Replies: 136
    Last Post: 01-16-2008, 08:09 AM
  2. Strange loop
    By D@rk_force in forum C++ Programming
    Replies: 22
    Last Post: 12-18-2004, 01:40 PM
  3. Languages dying
    By Zewu in forum A Brief History of Cprogramming.com
    Replies: 31
    Last Post: 07-29-2003, 10:08 AM
  4. Languages
    By KrAzY CrAb in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 02-18-2003, 11:23 AM
  5. Programming Languages
    By DarkViper in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 12-12-2002, 01:28 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21