W3C home > Mailing lists > Public > xproc-dev@w3.org > August 2011

The XProc Quine

From: mozer <xmlizer@gmail.com>
Date: Thu, 11 Aug 2011 16:38:35 +0200
Message-ID: <CAKdwC_MjnmxDPiDPXSox34920t+vdUxEK2tPT6tOoawX2ahZiw@mail.gmail.com>
To: XProc Dev <xproc-dev@w3.org>
http://blog.innovimax.fr/index.php/2011/08/11/38-xproc-quine

You may have heard of the Quicksort implementation in
XProc<http://en.literateprograms.org/Quicksort_(XProc)>
 of the famous algorithm <http://en.wikipedia.org/wiki/Quicksort> in
XProc<http://w3.org/TR/xproc>

Here comes now the Quine <http://en.wikipedia.org/wiki/Quine_(computing)>, *
i.e* a computer program which takes no input and produces a copy of its own
source code as its only output.

<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="1.0">
 <p:documentation>
   <p>(c) Innovimax 2011 - The first XProc Quine</p>
 </p:documentation>
 <p:output port="result"/>
 <p:identity>
   <p:input port="source">
     <p:inline>
       <p:declare-step version="1.0">
         <p:documentation>
           <p>(c) Innovimax 2011 - The first XProc Quine</p>
         </p:documentation>
         <p:output port="result"/>
         <p:identity>
           <p:input port="source">
             <p:inline/>
           </p:input>
         </p:identity>
         <p:insert match="p:inline" position="first-child">
           <p:input port="source"/>
           <p:input port="insertion"/>
         </p:insert>
       </p:declare-step>
     </p:inline>
   </p:input>
 </p:identity>
 <p:insert match="p:inline" position="first-child">
   <p:input port="source"/>
   <p:input port="insertion"/>
 </p:insert>
</p:declare-step>

It works in any of the many implementations of
XProc<http://xproc.org/implementations/>.
If you run for GPL <http://en.wikipedia.org/wiki/GNU_General_Public_License>,
go look atQuiXProc <http://code.google.com/p/quixproc>
Xmlizer
Received on Thursday, 11 August 2011 14:39:02 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 11 August 2011 14:39:03 GMT