The following module was proposed for inclusion in the Module List: modid: Ruby::Collections DSLIP: bdpr2 description: Ruby collections implementation in Perl userid: CLAIR (Clair Lee) chapterid: 6 (Data_Type_Utilities) communities: https://github.com/wnameless/ruby-collections-perl/wiki
similar: rationale: To improve the productivity of Perl, we try to implement around 200 methods inspired by Ruby collections for Perl array and hash. We build up those methods based on the Perl tie 'StdArray' and tie 'StdHash' features. We call these implementations Ruby::Array and Ruby::Hash. We try to make these implementations can be treated as the ordinary Perl array and hash. All modules which are design for Perl array and hash can be used on Ruby::Array and Ruby::Hash as well. Furthermore, we made many improvements on the behaviors of Ruby::Array and Ruby::Hash. 1. We provide friendly api to build up Ruby::Array and Ruby::Hash quickly. For example: ra( 1, 2, 3 ) -> [ 1, 2, 3 ] ra( [ 1, 2, 3 ] ) -> [ 1, 2, 3 ] ra( ra( 1, 2, 3 ) ) -> [ [ 1, 2, 3 ] ] rh( { 'a' => 1 } ) -> { 'a' => 1 } rh( 'a' => 1 ) -> { 'a' => 1 } rh( 'a', 1 ) -> { 'a' => 1 } 2. Ruby::Hash enumerates its values in the order that the corresponding keys were inserted. In other words, it becomes an ordered hash. 3. When using array or hash to be the key of a Ruby::Hash, it automatically translates the data structure into string form. For example: rh( [ 1 , 2 ] => 3 ) -> { [ 1, 2 ] => 3 } instead of { ARRAY(0x7fa4320052b8) => 3 } 4. Complex data structure comparison becomes mush easier. For example: ra( 1, { 2 => 3 } ) == [ 1, { 2 => 3 } ] # return 1 5. Many operators are overloaded to make Ruby::Array and Ruby::Hash easier to use. For example: ra( 1, 2 ) << 3 -> [ 1, 2, 3 ] ra( 1, 2, 3 ) - [ 3, 4 ] -> [ 1, 2 ] ... 6. Fluent interface make code much easier to read and use. For example: rh( 1 => 2, 3 => 4 )->to_a->flatten->map( sub { $_[0] * 2 } ) -> [ 2, 4, 6, 8 ] enteredby: CLAIR (Clair Lee) enteredon: Wed Apr 24 15:54:14 2013 GMT The resulting entry would be: Ruby:: ::Collections bdpr2 Ruby collections implementation in Perl CLAIR Thanks for registering, -- The PAUSE PS: The following links are only valid for module list maintainers: Registration form with editing capabilities: https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=26d00000_e919311e5465e05a&SUBMIT_pause99_add_mod_preview=1 Immediate (one click) registration: https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=26d00000_e919311e5465e05a&SUBMIT_pause99_add_mod_insertit=1 Peek at the current permissions: https://pause.perl.org/pause/authenquery?pause99_peek_perms_by=me&pause99_peek_perms_query=Ruby%3A%3ACollections