September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,4 +1,4 @@
|
|||
var proggie = '3 4 2 * 1 5 - 2 3 ^ ^ / +';
|
||||
var proggie = '3 4 2 * 1 5 - 2 3 ^ ^ / +'
|
||||
|
||||
class RPN(arr=[]) {
|
||||
|
||||
|
|
@ -10,10 +10,10 @@ class RPN(arr=[]) {
|
|||
|
||||
method run(p) {
|
||||
p.each_word { |w|
|
||||
say "#{w} (#{arr})";
|
||||
say "#{w} (#{arr})"
|
||||
given (w) {
|
||||
when (/\d/) {
|
||||
arr << w.to_f
|
||||
arr << Num(w)
|
||||
}
|
||||
when (<+ - * />) {
|
||||
self.binop(w)
|
||||
|
|
@ -30,4 +30,4 @@ class RPN(arr=[]) {
|
|||
}
|
||||
}
|
||||
|
||||
RPN.new.run(proggie);
|
||||
RPN.new.run(proggie)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue