Writing a quine

April 1, 2009 at 19:53
filed under Dynamics AX
Tagged ,

While reading through Wikipedia, I came across something called a quine, and here is its definition:

In computing, a quine is a computer program which produces a copy of its own source code as its only output.

I was inspired by this and decided to make a quine in X++, the programing language of Microsoft Dynamics AX.

static void quine(Args _args)
{
    #AOT;
    print TreeNode::findNode(strfmt(#JobPath,"quine")).AOTgetSource();
    pause;
}

It’s a job that finds it’s own tree node in the AOT, gets the source of that node and prints it. I originally wrote it all on one line, because I like the look of that better, but I didn’t do that here for readability.

Now I’m not entirely sure if this qualifies as a quine, because a quine can have no input, and using the method AOTgetSource could be seen as cheating. But anyway, it reproduces itself,  it’s short, and it made me happy.

1 comment

RSS / trackback

  1. USER

    We can run Another job by modifying this
    TreeNode::findNode(strfmt(#JobPath,”Job_Hello”)).AOTrun();

respond