Omnimaga

Calculator Community => HP Calculators => Topic started by: iconmaster on December 03, 2014, 05:33:40 pm

Title: A Quine in HP Prime
Post by: iconmaster on December 03, 2014, 05:33:40 pm
Just a little something for the lulz. Name the file it goes in "QUINE", of course.

Code: [Select]
EXPORT QUINE()
BEGIN
 MSGBOX(Programs["QUINE"])
END;

While I'm at it, have a program (named SELFMOD) that stores a variable, but never uses the := operator to store new values in it:

Code: [Select]
x:=0;

EXPORT SELFMOD()
BEGIN
 MSGBOX("x is "+x);
 Programs["SELFMOD"]:=LEFT(Programs["SELFMOD"],3)+(x+1)+MID(Programs["SELFMOD"],INSTRING(Programs["SELFMOD"],";"));
END;
Title: Re: A Quine in HP Prime
Post by: Hooloovoo on December 04, 2014, 02:12:30 am
I think to qualify as a quine, a program cannot read its own source. But this whole thing is really cool. I should play around with the new program-editing features. I feel like they could make user keys more powerful possibly.