This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def rpn(str: String): Int = rpnPrime(str.split(' ').toList, Nil) | |
def rpnPrime(str: List[String], stack: List[Int]): Int = (str, stack) match { | |
case ("+"::t, y::x::zs) => rpnPrime(t, (x + y) :: zs) | |
case ("-"::t, y::x::zs) => rpnPrime(t, (x - y) :: zs) | |
case ("*"::t, y::x::zs) => rpnPrime(t, (x * y) :: zs) | |
case ("/"::t, y::x::zs) => rpnPrime(t, (x / y) :: zs) | |
case ("%"::t, y::x::zs) => rpnPrime(t, (x % y) :: zs) | |
case ( n::t, zs) => rpnPrime(t, (n.toInt) :: zs) | |
case _ => stack.head |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
INPUT SAMPLE: | |
VAR NUMBER = 25 | |
VAR STRING = "ALEX" | |
VAR ERRO = "THAT's NOT CAUSE AN ERROR :)" | |
PRINT ERRO | |
PRINT "ALEXANDRE" | |
PRINT NUMBER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <vector> | |
#include <windows.h> | |
using namespace std; | |
class Buffer: public vector<unsigned char> | |
{ | |
public: | |
void push_dword(DWORD dw) |
OlderNewer