Re: Grammatical Recursion
From: Des Small (des.small_at_bristol.ac.uk)
Date: 12/17/04
- Next message: Jacques Guy: "Re: Grammatical Recursion"
- Previous message: koster_at_laurence.net: "Spanish questions"
- In reply to: Jacques Guy: "Re: Grammatical Recursion"
- Next in thread: Jacques Guy: "Re: Grammatical Recursion"
- Reply: Jacques Guy: "Re: Grammatical Recursion"
- Reply: Florian Laws: "Re: Grammatical Recursion"
- Messages sorted by: [ date ] [ thread ]
Date: 17 Dec 2004 18:26:46 +0000
Jacques Guy <jguy@alphalink.com.au> writes:
> Greg Lee wrote:
>
> > As you say, recursion is not equivalent to iteration, contrary to
> > what Jacques said.
>
>
> Merde! I never wrote that. They are _functionally_ equivalent,
> insofar as anything you do through recursive function calls,
> you can do through simple iteration without function calls,
> e.g.:
>
> factorial = 1
> for i=1 to n do
> factorial = factorial * i
> end for
Not all examples are trivial. The Ackermann function, for example:
def Ack(M, N):
if (not M):
return( N + 1 )
if (not N):
return( Ack(M-1, 1) )
return( Ack(M-1, Ack(M, N-1)) )
To rewrite this "iteratively" would surely involve hand-management of
a stack, which might as well be recursion. Unless you're going to get
all continuation-passing or something.
[...]
Des
likes filo better as pastry
-- "[T]he structural trend in linguistics which took root with the International Congresses of the twenties and early thirties [...] had close and effective connections with phenomenology in its Husserlian and Hegelian versions." -- Roman Jakobson
- Next message: Jacques Guy: "Re: Grammatical Recursion"
- Previous message: koster_at_laurence.net: "Spanish questions"
- In reply to: Jacques Guy: "Re: Grammatical Recursion"
- Next in thread: Jacques Guy: "Re: Grammatical Recursion"
- Reply: Jacques Guy: "Re: Grammatical Recursion"
- Reply: Florian Laws: "Re: Grammatical Recursion"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|