The fibonacci.pl.raku.c Polyglot

Published at 2014-03-24T21:32:53+00:00; Updated at 2022-04-23

In computing, a polyglot is a computer program or script written in a valid form of multiple programming languages, which performs the same operations or output independent of the programming language used to compile or interpret it.

https://en.wikipedia.org/wiki/Polyglot_(computing)

The Fibonacci numbers

For fun, I programmed my own Polyglot, which is both valid Perl, Raku, C and C++ code (I have added C++ and Raku support in 2022). The exciting part about C and C++ is that $ is a valid character to start variable names with:

You can find the full source code at GitHub:

https://codeberg.org/snonux/perl-c-fibonacci

Let's run it with C and C++

Let's run it with Perl and Raku

It's entertaining to play with :-).

E-Mail your comments to `paul@nospam.buetow.org` :-)

Back to the main site

Proxied content from gemini://foo.zone/gemfeed/2014-03-24-the-fibonacci.pl.c-polyglot.gmi (external content)

Gemini request details:

Original URL
gemini://foo.zone/gemfeed/2014-03-24-the-fibonacci.pl.c-polyglot.gmi
Status code
Success
Meta
text/gemini;
Proxied by
kineto

Be advised that no attempt was made to verify the remote SSL certificate.