# Re: Smullyan Shmullyan, give me a real example

```
Le 22-mai-06, à 18:20, Tom Caylor a écrit :```
```
>
> Bruno Marchal wrote:
>> ...
>> I give, for all, one last exercise before introducing diagonalization:
>> define recursively in an explicit way the operation [i+1] from the
>> preceding operation [i]. If you know a "computer language" (Fortran,
>> Lisp, Prolog, c++, Java, whatever ...) write the program. If you don't
>> know any such language, read my "combinators posts" and program those
>> function with S and K, (if you have the time). Well, just be sure you
>>
>> Must leave now.
>>
>> Bruno
>
> I would have thought that my previous result captures this:
>
>>> Generalizing this, given the function in the sequence corresponding
>>> to
>>> the operation of degree N.
>>>
>>> f(N,m,n) = f(N-1,m,...f(N-1,m,n)...)         (f(N-1) taken n times)
>>>
>

Well, if the representation is explicit, you should avoid the "...".
But I think I see what you mean.

> If we express my "f(i,m,n)" as your "m [i] n", then this would be
>
> m [i] n = m [i-1] (m [i-1] (...(m [i-1] n)...)       ( [i-1] taken n
> times )

Same remark.

>
> Or if we just look at "m [i] m" to keep it simpler as you suggest,
>
> m [i] m = m [i-1] (m [i-1] (...(m [i-1] m)...)       ( [i-1] taken n
> times )

I guess you mean "m times"   (not "n").

>
> In terms of a program, in a sort of pseudocode, to compute m [i] n,
>
> initialize result to (m [i-1] n)
> do the following n-1 times
>   set result to (m [i-1] result)
> end do

All right, this is explicit.  Personally  I prefer "recursive" coding.
This is allowed in most modern language. But let us not take such
implementation issue too seriously.
The best would consist in implementing it by yourself on some real
machine, in case you would doubt your code.

>
> The input is (m [i-1] n), the end "result" is m [i] n.  If we simply
> want m [i] m, then set the input to (m [i-1] m).
>
> Of course in a real computer language you would have to worry about
> numerical representation and storage.

Many high level language make it possible  not to  worry about such
representations, and everything I will develop does not depend on those
issues. More latter.

Bruno

PS I got your three last emails  in double (in each post)  I don't know
why.

http://iridia.ulb.ac.be/~marchal/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Everything List" group.
To post to this group, send email to everything-list@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at