rpl.rb/lib/core/store.rb

20 lines
474 B
Ruby
Raw Normal View History

2021-12-07 16:51:33 +01:00
# frozen_string_literal: true
module Rpl
module Lang
module Core
module_function
# evaluate (run) a program, or recall a variable. ex: 'my_prog' eval
def sto( stack, dictionary )
stack, args = Rpl::Lang::Core.stack_extract( stack, [:any, %i[name]] )
# TODO
dictionary.add( args[1][:value], proc { |stk| Rpl::Lang::Core.eval( stk << args[0][:value], dictionary ) } )
[stack, dictionary]
end
end
end
end