background preloader

Code compare

Facebook Twitter

RPN Calc in Many Langs. Index.shtml, last modified: Sunday, 25-Jan-2009 20:36:52 CET You may have heard of things such as the 99 Bottles of Beer, Hello World!

RPN Calc in Many Langs

, The Quine Page, Accumulator Generator, ROT13 or Mindstab Multi Language Prime Number Projects. This is a similar project. The goal is to implement a reverse polish notation calculator in as many different programming languages as possible. There are two reasons for doing this. An RPN (a.k.a. postfix) calculator should be able to take an expression like which is usually expressed as "(19 + 2.14) * (4.5 - 2 / 4.3)", and respond with The program should (where applicable) read expressions from standard input and print the top of the stack to standard output when a newline is encountered. Not all of the programs below have been confirmed to actually work.

We all want this list to grow, so please send your contributions to arnerup@kth.se. Honorable mention: A Unix one-liner submitted by conio:sed -ru 's/(.+)/10k & p/' | dc Ada Author: nrlDownload Assembler (MC68000) ROT13. From the Jargon File: rot13 /rot ther'teen/ /n.

ROT13

,v./ [Usenet: from `rotate alphabet 13 places'] The simple Caesar-cypher encryption that replaces each English letter with the one 13 places forward or back along the alphabet, so that "The butler did it! " becomes "Gur ohgyre qvq vg! " Most Usenet news reading and posting programs include a rot13 feature. It is used to enclose the text in a sealed wrapper that the reader must choose to open -- e.g., for posting things that might offend some readers, or spoilers. The purpose of this page is to collect and display various ROT13 implementations, in as wide a variety of languages as possible. And now, sorted by the language... Here are some languages that I'd like to see ROT13 in. The Open Directory Project 's Programming Language links Please stop sending me implementations of ROT13 written by other people. See a tally of how many implementations each contributor has written. Awhile back, somebody wrote a patch for ssh to support ROT13 encryption.

Sieve Of Eratosthenes Algorithm. Implemented in any programming language The sieve of Eratosthenes is a simple algorithm created by an ancient Greek mathematician, for finding all prime numbers up to a specified integer.

Sieve Of Eratosthenes Algorithm

The algorithm is often used to compare the syntax of programming languages and the speed of compilers, or interpreters. The algorithm: Build a list of all the integers greater than one and less than or equal to n. Strike out the multiples of all primes less than or equal to the square root of n, then the numbers that are left are the primes. In pseudo code (actually Scriptol code): constant int n=50array a = {0} for int i in 1..n let a[i] = 1 int m = int(sqrt(n)) for int i in 2..m if a[i] for int j in 2.. n step 2 a[i * j] = false /for /if /for Displaying the prime numbers: for int x in 0 .. n if a[x] print x /for If you want to use the algorithm for benchmarking and comparing some programming languages, implement the code above.

Ada Awk Basic QuickBasic, reference manual for Apple Macintosh, by Microsoft. Bash #! Mozilla Firefox.