Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: primitive instruction for programming |
| Date | 2015-04-21 11:48 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <87a8y169lb.fsf@bsb.me.uk> (permalink) |
| References | (5 earlier) <mggbmn$i3b$1@dont-email.me> <ba8f2a5d-9d51-4ec1-9901-47c504c601f5@googlegroups.com> <mh4som$57o$1@dont-email.me> <b40d0c3d-48c9-4c4c-a59a-0da887e88ff8@googlegroups.com> <mh55gm$229$1@dont-email.me> |
David Brown <david.brown@hesbynett.no> writes: > On 21/04/15 10:34, asetofsymbols@gmail.com wrote: >> int s[10000]; >> int *r=s+9999; *Lim=r, z; >> >> #define G(a,b) if(a)goto b >> #define push(a) r>=s?*r=a,--r:0 >> #define pop(a) r<Lim?++r, a=*r:0 >> #define ret pop(z); G(1,z); >> #define ca(a,m) z=m; push(z); G(1,a) >> >> f(a,b,c) >> >> Should traslate to >> push(c); push(b); push(a); >> ca(f,label); >> label: >> pop(z);pop(z);pop(z); >> > > You have /completely/ missed the point. > > The original claim was that G /alone/ could replace any control > structure in C. It can't - it is unable to replace the call/return > mechanism needed for recursion, which is /required/ for some types of > functions (like the Ackerman function given). You can add extra data, > such as a stack, and use that along with G to implement recursion - but > you cannot do it with just G. That's not how this problem is usually set up; adding data is not usually considered a problem -- after all, much of the data is there in the recursive function version anyway. The rules of the "what makes a minimal computational system" usually permit any finite amount of extra data that might be required (though in some more restrictive cases one might object to quantities that grow exponentially with the problem size). -- Ben.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: primitive instruction for programming Emiliano Gomes Padilha <egpadilha@gmail.com> - 2015-04-20 14:27 -0700
Re: primitive instruction for programming Emiliano Gomes Padilha <egpadilha@gmail.com> - 2015-04-20 15:12 -0700
Re: primitive instruction for programming Bartc <bc@freeuk.com> - 2015-04-21 00:17 +0100
Re: primitive instruction for programming Emiliano Gomes Padilha <egpadilha@gmail.com> - 2015-04-22 11:07 -0700
Re: primitive instruction for programming David Brown <david.brown@hesbynett.no> - 2015-04-21 09:04 +0200
Re: primitive instruction for programming Robert Wessel <robertwessel2@yahoo.com> - 2015-04-21 03:02 -0500
Re: primitive instruction for programming asetofsymbols@gmail.com - 2015-04-21 01:34 -0700
Re: primitive instruction for programming David Brown <david.brown@hesbynett.no> - 2015-04-21 11:34 +0200
Re: primitive instruction for programming Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-04-21 11:48 +0100
Re: primitive instruction for programming David Brown <david.brown@hesbynett.no> - 2015-04-21 13:10 +0200
Re: primitive instruction for programming Bartc <bc@freeuk.com> - 2015-04-21 10:53 +0100
csiph-web