Author Topic: A Quine in HP Prime  (Read 3997 times)

0 Members and 1 Guest are viewing this topic.

Offline iconmaster

  • LV3 Member (Next: 100)
  • ***
  • Posts: 82
  • Rating: +5/-0
    • View Profile
A Quine in HP Prime
« 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;

Offline Hooloovoo

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 225
  • Rating: +22/-0
    • View Profile
Re: A Quine in HP Prime
« Reply #1 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.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale." -tr1p1ea
Spoiler For some of the calcs I own:



(actually I have quite a few more than this, but I don't feel like making bars for them all.)