Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #3065

Re: hash of arrays

From "WJ" <w_a_x_man@yahoo.com>
Newsgroups comp.lang.ruby
Subject Re: hash of arrays
Date 2011-04-17 16:37 +0000
Organization NewsGuy - Unlimited Usenet $19.95
Message-ID <iof4vi0r4p@enews2.newsguy.com> (permalink)
References <17ed4aba89dcdda100deb6592ec4f9f5@ruby-forum.com>

Show all headers | View raw


David Sprague wrote:

> I'm wrote this code to bin a list of words by word-length:
> 
> dict = Hash.new([])
> 
> dict_file.each do |line|
>   line.chomp!()
>   dict[line.length] << line
> end

words = IO.read( "data2" ).strip.split( /\s+/ )
dict = words.group_by{|w| w.size}

Back to comp.lang.ruby | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

hash of arrays David Sprague <david.sprague@gmail.com> - 2011-04-12 20:06 -0500
  Re: hash of arrays Roger Braun <roger@rogerbraun.net> - 2011-04-12 20:27 -0500
    Re: hash of arrays Roger Braun <roger@rogerbraun.net> - 2011-04-12 20:57 -0500
  Re: hash of arrays Tom Reilly <w3gat@nwlagardener.org> - 2011-04-12 20:52 -0500
  Re: hash of arrays jake kaiden <jakekaiden@yahoo.com> - 2011-04-12 22:05 -0500
  Re: hash of arrays botp <botpena@gmail.com> - 2011-04-12 22:05 -0500
  Re: hash of arrays "WJ" <w_a_x_man@yahoo.com> - 2011-04-17 16:37 +0000

csiph-web