COMP.THEORY-------------- < Пред. | След. > -- < @ > -- < Сообщ. > -- < Эхи > --
 Nп/п : 83 из 100
 От   : Charlie-Boo                         2:5075/128        02 сен 23 11:43:51
 К    : Richard Damon                                         02 сен 23 21:46:03
 Тема : Re: Simple Programming Problem but How Many Ways to Do It?
----------------------------------------------------------------------------------
                                                                                 
@MSGID:
<6f144545-d915-436d-b90d-a610ae747dfcn@googlegroups.com> 264cd2ad
@REPLY: xMqa.162772@fx12.iad>
0701be96
@REPLYADDR Charlie-Boo <shymathguy@gmail.com>
@REPLYTO 2:5075/128 Charlie-Boo
@CHRS: CP866 2
@RFC: 1 0
@RFC-References:
<865bc1f2-ae48-48cb-8140-4fb96fb33eeen@googlegroups.com> xMqa.162772@fx12.iad>
@RFC-Message-ID:
<6f144545-d915-436d-b90d-a610ae747dfcn@googlegroups.com>
@TZUTC: -0700
@PID: G2/1.0
@TID: FIDOGATE-5.12-ge4e8b94
On Saturday, August 26, 2023 at 1:24:35 PM UTC-4, Richard Damon wrote:
> On 8/26/23 1:11 PM, Charlie-Boo wrote: 
> > Program 1 returns a Boolean value call it A. 
> > Program 2 returns a Boolean value call it B. 
> > We want one program that returns A ^ B (the value of A and B). 
> > We don`t want to call 1 and 2. 
> > We want to take the code in these two programs and create a new program. 
> > 
 > > Assume we have the common commands and expression elements e.g.
those of PHP. 
> > How many different programs can we create? 
> > 
> > C-B
> A fundamental property of programming is that you can create an infinite 
> variation of programs that achieve a given goal. At least as long as the 
> requirements are written semantically (this is the result we need to 
> generate) and not with syntactic limits (it must be written this way). 

> THough you have a syntactic restriction in your definition (we can`t 
> "call" A or B, since you can always replace a call to a function with 
> the code for that function, and you specified we have the code, we can 
> use this property. 

> Now, the question comes down to terminology, if you have multipe ways of 
> implementing a given algorithm, are they all "one program", or is each 
> implementation consider a different program. 

> Normal terminology calls them diferent programs, so your answer is infinite. 

> There may be a finite (but large) practical limit established by the 
> language you express the program in, and the machine it will be run on.
 I said use common programming language constructs e.g. PHP. As you
create alternatives, you start to see the difference between algorithm and
implementation.
 Perhaps the simplest way is 3 parts. Assuming variable name
conflicts are removed:
1. The code for A but save the value returned in variable A.
2. The code for B but save the value returned in variable B.
3. return A&&B

There ae LOTS more.

C-B
--- G2/1.0
 * Origin: usenet.network (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5058/104 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх