Sha256: 8d63e9292a8f91a82f956969f15548029ec6a152747a92a325aaab2528890645

Contents?: true

Size: 758 Bytes

Versions: 2

Compression:

Stored size: 758 Bytes

Contents

module PLang
  module VM
    module PFunctions
      def add_to_interpreter_list_functions

        def_object_message "{list: x, xs}", :head do |object|
          plambda do |value|
            object.params[0]
          end
        end

        def_object_message "{list: x, xs}", :tail do |object|
          plambda do |value|
            object.params[1]
          end
        end

        def_object_message "{list: x, xs}", :concat do |object|
          plambda "x" do |value|
            PObject.new(:list, [value[0], object])
          end
        end

        def_object_message "{empty}", :concat do |object|
          plambda "x" do |value|
            PObject.new(:list, [value[0], object])
          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/plist.rb
p-lang-0.3.0 lib/vm/core/plist.rb