Sha256: 601418a7938f1e92cf8fb80dd14c7ac2efb78dadce97bc8fafb28cca7b5e49ce

Contents?: true

Size: 591 Bytes

Versions: 13

Compression:

Stored size: 591 Bytes

Contents

module Ludy
  # fib = 0 : 1 : [x+y | (x, y) <- zip fib (tail fib)]
  # combos = List[->(x,y){[x,y]}, 0..1, 2..3]
  class List # :nodoc:
    private :initialize
    class << self
      def [] target, *args
        raise ArgumentError.new("you need at least #{target.arity} arguments(sources) for #{target}") if args.size < target.arity
        sources = args[0...target.arity]
        conditions = args[target.arity..-1]
        create_array sources, conditions
      end

      private
      def create_array sources, conditions
        sources.traspose.flatten
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
godfat-ludy-0.1.13 lib/ludy/list.rb
ludy-0.1.15 lib/ludy/list.rb
ludy-0.1.11 lib/ludy/list.rb
ludy-0.1.2 lib/ludy/list.rb
ludy-0.1.10 lib/ludy/list.rb
ludy-0.1.13 lib/ludy/list.rb
ludy-0.1.4 lib/ludy/list.rb
ludy-0.1.3 lib/ludy/list.rb
ludy-0.1.6 lib/ludy/list.rb
ludy-0.1.7 lib/ludy/list.rb
ludy-0.1.8 lib/ludy/list.rb
ludy-0.1.9 lib/ludy/list.rb
ludy-0.1.5 lib/ludy/list.rb