Hi,

Here is a function to test whether a quotation, when called, returns itself
(apparently this is called a Quine <
http://en.wikipedia.org/wiki/Quine_(computing)<http://en.wikipedia.org/wiki/Quine_%28computing%29>
>):

USING: quotations
: quine? ( quotation -- bool ) dup call = ;

It is an interesting puzzle to try to write one, so I won't paste my answer
in plaintext. However, the following evaluates to t.

USING: base64 parser ;
"VVNJTkc6IGtlcm5lbCBxdW90YXRpb25zIGFycmF5cyA7IFsgWyBcIGR1cCBcIGNhbGwgXCA+cXVvdGF0aW9uIDRhcnJheSBdIGR1cCBjYWxsID5xdW90YXRpb24gXQ=="
base64> eval quine?

If anyone comes up with another solution, I'd be very interested to see it.

Cheers,
Paul
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to