Sha256: 4f3f28397f473081ba07593d841827de51fa260f7a7cab96816d6540f0639d2e

Contents?: true

Size: 744 Bytes

Versions: 2

Compression:

Stored size: 744 Bytes

Contents

module PLang
  module VM
    module PFunctions
      def add_to_interpreter_boolean_functions
        
        def_object_message "{boolean: x}", :_and do |object|
          plambda "{boolean: y}" do |value|
            PObject.new(:boolean, [(object.params[0] and value[0].params[0])])
          end
        end
        
        def_object_message "{boolean: x}", :_or do |object|
          plambda "{boolean: y}" do |value|
            PObject.new(:boolean, [(object.params[0] or value[0].params[0])])
          end
        end
        
        def_object_message "{boolean: x}", :_not do |object|
          plambda do
            PObject.new(:boolean, [(not object.params[0])])
          end
        end
        
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
p-lang-0.3.1 lib/vm/core/pboolean.rb
p-lang-0.3.0 lib/vm/core/pboolean.rb