From 30fc4e8f74315a92aaec36dfb9a8d4efa0a21791 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 7 Apr 2023 00:49:19 +0300 Subject: exact style --- .../2014-03-24-the-fibonacci.pl.c-polyglot.html | 41 +++++++++++++++------- 1 file changed, 28 insertions(+), 13 deletions(-) (limited to 'gemfeed/2014-03-24-the-fibonacci.pl.c-polyglot.html') diff --git a/gemfeed/2014-03-24-the-fibonacci.pl.c-polyglot.html b/gemfeed/2014-03-24-the-fibonacci.pl.c-polyglot.html index 9af843f1..ab51d6bc 100644 --- a/gemfeed/2014-03-24-the-fibonacci.pl.c-polyglot.html +++ b/gemfeed/2014-03-24-the-fibonacci.pl.c-polyglot.html @@ -8,12 +8,18 @@ -

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:

+

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:
+
 #include <stdio.h>
 
@@ -57,9 +63,13 @@ BEGIN {
     }
 }
 
-

You can find the full source code at GitHub:

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

Let's run it with C and C++

+
+You can find the full source code at GitHub:
+
+https://codeberg.org/snonux/perl-c-fibonacci
+
+

Let's run it with C and C++


+
 % gcc fibonacci.pl.raku.c -o fibonacci
 % ./fibonacci
@@ -97,7 +107,9 @@ fib(8) = 21
 fib(9) = 34
 fib(10) = 55
 
-

Let's run it with Perl and Raku

+
+

Let's run it with Perl and Raku


+
 % perl fibonacci.pl.raku.c
 Hello, welcome to the Fibonacci Numbers!
@@ -133,9 +145,12 @@ fib(8) = 21
 fib(9) = 34
 fib(10) = 55
 
-

It's entertaining to play with :-).

-

E-Mail your comments to hi@paul.cyou :-)

-Back to the main site
+
+It's entertaining to play with :-).
+
+E-Mail your comments to hi@paul.cyou :-)
+
+Back to the main site