Re: Create a word that returns its own name?
  Home FAQ Contact Sign in
comp.lang.forth only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.forth Profile…
 Up
Re: Create a word that returns its own name?         


Author: George Hubert
Date: Sep 29, 2006 09:06

John Passaniti wrote:
> Anton Ertl wrote:
>> Well, we already have a quine-type word in the standard: SOURCE. Use it
>> like
>>
>> source type
>>
>> and you have a quine program.
>
> Does anyone here understand what a quine is? Is it that difficult to
> Google the term and learn both what it means and why it is interesting
> from a computer science perspective?
>
> Not that Wikipedia is the last word on anything, but the definition
> provided there is consistent with the one I've seen *everywhere* else:
>
> http://en.wikipedia.org/wiki/Quine
>
> So "source type" is not a quine program (unless "source type" was the
> output). The point of a quine is not that when you type in something ...
Show full article (1.01Kb)
1 Comment
Re: Create a word that returns its own name?         


Author: John Passaniti
Date: Sep 29, 2006 10:43

George Hubert wrote:
> : QUINE S" SEE QUINE" EVALUATE ;
>
> works in W32F V6.11.10 exactly (I cut and pasted the output -;)

A quine much like this was submitted here:

http://www.nyx.net/~gthompso/quine.htm

This is a quine (assuming your 'see' generates *exactly* the same
thing), but it's obviously specific to a particular implementation of
Forth. In the implementation of Forth I currently have handy (pForth),
I see this when I execute 'quine':

( 40179A3C ) S" SEE QUINE" EVALUATE ;

So no, at least for this particular implementation of Forth, 'see' is
not a sufficient quine generator since the output isn't the same as the
input.

Those wondering why any of this matters should actually try to write a
quine that doesn't depend on having a decompiler. It's not a trivial
problem and it can lead to some interesting insights.
no comments

RELATED THREADS
SubjectArticles qty Group
Access 97 using ODBC returning SQL server ntext fields dont return the full datamicrosoft.public.sqlserver.odbc ·