Git Product home page Git Product logo

avl_tree's People

Contributors

billdueber avatar eric avatar jsvd avatar nahi avatar seiyria avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

avl_tree's Issues

Arguments not passed to a block provided with the ::new method

A block can be passed to Hash::new. The block will be run to produce default values.
See Hash::new docs for how this works with Hashes. Note that the block expects 2 arguments.

For example

$ cat test_hash.rb
require 'pp'
t = Hash.new {|h, k| h[k] = []}
t[12] << "boo"
pp t.keys
pp t.values

$ ruby test_hash.rb
[12]
[["boo"]]

But with AVLTree:

$ cat test_avl_tree.rb
require 'avl_tree'
require 'pp'
t = AVLTree.new {|h, k| h[k] = []}
p "OK so far"
t[12] << "boo"
pp t.keys
pp t.values

$ ruby test_avl_tree.rb
"OK so far"
test_avl_tree.rb:3:in `block in <main>': undefined method `[]=' for nil:NilClass (NoMethodError)
	from /Users/matt/.gem/ruby/2.4.0/gems/avl_tree-1.2.1/lib/avl_tree.rb:409:in `default_value'
	from /Users/matt/.gem/ruby/2.4.0/gems/avl_tree-1.2.1/lib/avl_tree.rb:378:in `[]'
	from test_avl_tree.rb:5:in `<main>'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.