No description or website provided.
Python
Adriandmen Merge pull request #9 from Coeur/patch-1
`Update README.md`
Latest commit fd236c1 Apr 9, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
commands.py Jan 19, 2017
info.txt
oasis.py Apr 24, 2017
primes.py Aug 30, 2016

# 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)
``````

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.