Skip to content
No description or website provided.
Python
Branch: master
Clone or download
Latest commit fd236c1 Apr 9, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md Update README.md Apr 9, 2019
commands.py added stuff Jan 19, 2017
info.txt
oasis.py fixed indentation and styling Apr 24, 2017
primes.py added prime function Aug 30, 2016

README.md

Oasis

Oasis is a stack-based language specialized in sequences. Not only as in the commands, but also as in how it calculates the sequences. With smart memory usage and memoization, it can calculate several sequences within seconds of time, without getting a recursion error or memory overflow.

What does a program look like?

Due to it's nature, you can only make a niladic program (which takes no argument), or a monadic program (which takes 1 argument). This might be changed in the future, because it's quite restricted at the moment. Let's see how the actual code looks like:

[code][predefined base cases]

First, the predefined base cases are taken off the actual code. These are used for the starting values for a sequence. For example, the code:

bc+10

stands for:

a(n) = bc+
a(0) = 0
a(1) = 1

The explanation for the code bc+:

b    # Calculates a(n - 1)
 c   # Calculates a(n - 2)
  +  # Adds them up

You probably already have guessed it :P. This calculates the Fibonacci sequence. It calculates n = 1000 in a split second.

Where is the implicit input?

Only if there are no elements specified at the end of a program, the user input will be used (n).

If there are elements specified, Oasis calculates the previous term of the sequence for the first time it's requested and n - 2 for the second time it's requested, et cetera. This depends on the arity of a command. For example, if + was called on an empty stack, it would first use a(n - 1) and since the second time it's called on an empty stack, it uses a(n - 2).

Exercise

All commands will be stored in the file info.txt. Using this and the documentation above, it's possible to golf the above Fibonacci calculator to 2 bytes.

Note

Some things are important when using Oasis:

  • Rather than input on STDIN, Oasis uses the command line arguments for input.
You can’t perform that action at this time.