caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Julien Moutinho <julien.moutinho@gmail.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Palindromic Quine
Date: Wed, 30 Jan 2008 05:06:01 +0100	[thread overview]
Message-ID: <20080130040600.GA22666@localhost> (raw)
In-Reply-To: <4BD387EA-7017-494A-AF01-D8216EE22501@mist.i.u-tokyo.ac.jp>

On Tue, Jan 29, 2008 at 12:23:45AM +0900, Keisuke Nakano wrote:
> A 'Palindromic Quine' code is now wanted by a shortest-code contest at:
>
>  http://golf.shinh.org/p.rb?Palindromic+Quine
>
> The code should be a Quine, which prints its own code without reading
> its source file. Additionally, the code should be palindromic, which
> reads the same forward as it does backward. Shorter code is better.
> Lots of programming languages are available including OCaml, of course.
>
> Please submit your palindromic Quine to the above contest if you find it.
> The deadline is Thursday, 7 February 2008, 16:46:39, GMT.
> All submitted programs will be revealed after the deadline.
> At present the shortest code in OCaml has 205 bytes.

Quite a cheating palindromic Quine, but that's enough for my being satisfied.

% cat t.ml
(*/*)()=()open Sys let tel()=();;let fer=print_string executable_name in tel
let ni eman_elbatucexe gnirts_tnirp=ref tel;;()=()let tel syS nepo()=()(*\*)
% O=`cat t.ml`; mkdir -p "(*"; ocamlc -w a t.ml -o "$O"; "$O"
(*/*)()=()open Sys let tel()=();;let fer=print_string executable_name in tel
let ni eman_elbatucexe gnirts_tnirp=ref tel;;()=()let tel syS nepo()=()(*\*)
% wc t.ml
  2  16 154 t.ml

Explanation:
  It just calls [print_string Sys.executable_name]
  with an ad-hoc executable name.
Also, I've considered that ")(" and "/\" are palindromic.

Cheers,

        Julien Moutinho.


  parent reply	other threads:[~2008-01-30  4:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-28 15:23 Keisuke Nakano
2008-01-28 15:37 ` [Caml-list] " Loup Vaillant
2008-01-28 15:39 ` Alain Frisch
2008-01-28 15:45   ` Till Varoquaux
2008-01-28 15:47     ` Loup Vaillant
2008-01-28 15:52     ` Romain Bardou
2008-01-28 17:12       ` Loup Vaillant
2008-01-28 15:49   ` Keisuke Nakano
2008-01-28 19:12 ` Martin Jambon
2008-01-29 19:58   ` Fabrice Marchant
2008-01-29 21:02     ` Bünzli Daniel
2008-01-29 21:43       ` Paolo Donadeo
     [not found]       ` <4b5157c30801291342r2094969r8f3497d9a82aea4d@mail.gmail.com>
2008-01-29 21:49         ` Bünzli Daniel
2008-01-30 12:57           ` Kuba Ober
2008-01-30 14:15             ` Keisuke Nakano
2008-01-30 16:28               ` Kuba Ober
2008-01-31  6:59             ` Cristian Baboi
2008-01-30  4:06 ` Julien Moutinho [this message]
2008-02-08 13:39 ` Keisuke Nakano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080130040600.GA22666@localhost \
    --to=julien.moutinho@gmail.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).