Sha256: 0fb435d158a92c410c0db661ab7389f9540963f72994310ae6d6abf26fc3a65f

Contents?: true

Size: 407 Bytes

Versions: 9

Compression:

Stored size: 407 Bytes

Contents

module Kl
  module Primitives
    module Lists
      def cons(a, b)
        Kl::Cons.new(a, b)
      end

      def hd(a)
        raise Kl::Error, "#{a} is not a list" unless a.kind_of? Kl::Cons
        a.hd
      end

      def tl(a)
        raise Kl::Error, "#{a} is not a list" unless a.kind_of? Kl::Cons
        a.tl
      end

      def cons?(a)
        a.kind_of? Kl::Cons
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
shen-ruby-0.10.0 lib/kl/primitives/lists.rb
shen-ruby-0.9.0 lib/kl/primitives/lists.rb
shen-ruby-0.8.1 lib/kl/primitives/lists.rb
shen-ruby-0.8.0 lib/kl/primitives/lists.rb
shen-ruby-0.7.0 lib/kl/primitives/lists.rb
shen-ruby-0.6.0 lib/kl/primitives/lists.rb
shen-ruby-0.5.0 lib/kl/primitives/lists.rb
shen-ruby-0.4.1 lib/kl/primitives/lists.rb
shen-ruby-0.4.0 lib/kl/primitives/lists.rb