Talk:Or
Here is an interpreter in Ruby for the so far known parts of Or:
program = File.open(ARGV[0],"r").read i = 0 stack = [] while i < program.length if program[i] == " " i += 1 if program[i] == "f" stack.push false end end i += 1 end
-OriginalOldMan (talk) 16:25, 11 June 2015 (UTC)
A program executive in Python:
def run(p): i = 0 stack = [] while i < len(p): if p[i] == " ": i += 1 if p[i] == "f": stack.append(False) i += 1 return stack print(run(" f"))
àÂse ëË y± comme×s! (Please sign your comments!) A (taÑ) 02:16, 3 August 2019 (UTC) 13:35, 17 October 2019 (UTC)
All known features of Or implemented in Keg (18 bytes)
?(!2/|``++`f `=[0.
Try it online! Hey, that's a good meme! JonoCode9374 (talk) 06:40, 19 October 2019 (UTC)
Above program explained because I can.
?(!2/|``++`f `=[0. ? #Take the program input (!2/| #repeat length of stack divided by 2 times ``++ #take the top two items and concatenate into a string `f ` #push "f " onto the stack =[0. #if the command is " f", push a 0 onto the stack and print
Hey, that's a good meme! JonoCode9374 (talk) 06:48, 19 October 2019 (UTC)
- Issue(s): doesn't work with
a f f
. Outputsf
.a f fa
prints nothing. Golfed a bit more. (10 bytes)
?( =[f=[0.
- Explained because I can.
? Take program input ( Repeat length of stack times =[ If TOS is a space: f=[ If new TOS is an f: 0. Output 0
- Just removed some more unneccecary string-conversions; I am using official Keg, I don't feel like using the unofficial one. Try it online! àÂse ëË y± comme×s! (Please sign your comments!) A (taÑ) 02:16, 3 August 2019 (UTC) 12:00, 20 October 2019 (UTC)
Here is an interpreter in C++:
#include <iostream> #include <stack> using namespace std; int main() { char data[10000]; cin >> data; int i = 0; stack <bool> s; do { switch (data[i]) { case ' ': if(data[i + 1] == 'f'){s.push(false);}else{i++;} default: i++; } } while(data[i] != '\0' && i <= 10000); }
Something tells me that we wont be getting more specification for some time. Areallycoolusername (talk) 14:08, 20 October 2019 (UTC)
Is Or really stack-based?
I am convinced that a stack has the term "push", but I realized that a queue and a deque also uses the term "push". We will never know what paradigm Or is in unless fungot gives a bit more information about it. --àÂse ëË y± comme×s! (Please sign your comments!) A (taÑ) 02:16, 3 August 2019 (UTC) 12:12, 20 October 2019 (UTC)
- For the time being, we can safely infer that the language is stack based. However, I believe that we should remove the joke category, as we don't know if the language was intended to be a joke, that being because we have insufficient specification. Areallycoolusername (talk) 21:42, 21 October 2019 (UTC)