[comp.lang.prolog] self-replicating programs

hirai@swatsun (Eiji "A.G." Hirai) (11/22/87)

Hi:

	There was an interesting discussion about self-replicating
programs a while back in this newsgroup.  Umm, can people send me what
they posted or what they've saved from it, pretty please...?  Help!
This was a problem on our regional ACM programming contest, and the
code for Pascal wasn't short.  I'm trying to show that the code for
Prolog can be a lot shorter.  Please, help me, <sob>...

						-ag hirai
-- 
Eiji "A.G." Hirai @ Swarthmore College, Swarthmore PA 19081 | Tel. 215-543-9855
UUCP:   {rutgers, ihnp4, cbosgd}!bpa!swatsun!hirai |  "All Cretans are liars."
Bitnet:       vu-vlsi!swatsun!hirai@psuvax1.bitnet |         -Epimenides
Internet:            bpa!swatsun!hirai@rutgers.edu |         of Cnossus, Crete

chiefdan@vax1.acs.udel.EDU (ROTH) (11/22/87)

>	There was an interesting discussion about self-replicating
>programs a while back in this newsgroup.  Umm, can people send me what
>they posted or what they've saved from it, pretty please...?  Help!
>This was a problem on our regional ACM programming contest, and the
>code for Pascal wasn't short.  I'm trying to show that the code for
>Prolog can be a lot shorter.  Please, help me, <sob>...
>
>						-ag hirai

That one was a pisser, wasn't it?

Pascal truly made that program a nasty thing to do.  (By the way, how did my
team end up doing?  I had to leave before dinner.)  I personally would have
voted for doing the program in lisp.  You know...

(defun x() (pp x))

That would have saved us all a lot of time.  I finally got one at the end, but
didn't get the sucker typed in in time.  Oh well.

Anyhow, I'm a novice in prolog and would appreciate knowing an answer for this.
How about re-posting it?

chiefdan

mendozag@pur-ee.UUCP (Grado) (11/23/87)

In article <309@udccvax1.acs.udel.EDU> chiefdan@vax1.acs.udel.EDU (Newsgroups) writes:
>>	There was an interesting discussion about self-replicating
>>programs a while back in this newsgroup.  Umm, can people send me what

>>I'm trying to show that the code for
>>Prolog can be a lot shorter.  Please, help me, <sob>...
>>						-ag hirai
>I'd have  voted for doing the program in lisp.  You know...
>
>(defun x() (pp x))
>
>Anyhow, I'm a novice in prolog and would appreciate knowing an answer for this.
>chiefdan

 By analogy, if you accept the above Lisp program as valid, I guess you can also
 accept the following Prolog code:

  x :-
     listing(x/0).

 provided you don't have another clause for x of same arity. Or any other
 arity if you don't use x/0.
 Dull, isn't it?

 I am would like to see the mentioned previous postings.

 Vicid H) T