Labrador-0.1 beta release (+ longish Release Note)

Hi list

I just released my first beta version of Labrador, renamed as
“The Lazy Programmer’s Best Friend”

------------------------------------ 8<

#* Labrador, The Lazy Programmer’s Best Friend.
#* Distributed under the terms of the BSD License.
#* Copyright © 2007 Robert D.
#* All rights reserved.

Release 0.1

Labrador is a Ruby Extension Library orbiting around two centers of
* The Lazy Programmer’s Best Friend.
* Interesting Features I want to play with, which are in the
Experimental Package.

The Lazy Programmer’s Best Friend tries to make the programmers life
as easy as possible, e.g.
hash.vselect.odd? get a selection of Hash were all values are

or  get an array with the successor of each original

or>, 0) get only the positive elements of an array

These principles are extended to most enum methods.

Whenever such extensions break Backward Compatibility they are put
into the labrador/bark package to warn the user, that for example
allows you to do very powerfull things with Enumerable#grep and

Right now the features that interest me personally are in the
labrador/exp package which is experimental and might change or go
away. If mature and useful they might move into labrador/concepts
or something similar.

In this release there is only exp/ppp a primitive and slow,
but powerfull Prototype extension as described here:

Backward Compatible Extensions in labrador/* and labrador/enum/*
* Hash unification Hash#hmap, returning a hash, #kmap and #vmap
returning a hash and changing keys/values only.
* Hash#hselect as select but returning a Hash.
* Hash#reject with Magic Dot and Symbol Send Semantics
* Hash#hgrep/vgrep/kgrep returning hashes and filtering on blocks
* String#edit a scan on stereoids allowing to
change the matched parts of the string.
e.g. s.edit(/$(\w+)/){ |name| ENV[name] || true }
For shell variable substitution in a string.
* Operator form for Enumerable#inject
e.g. (1…100).inject(:+) --> 5050
* Introduction of the bark package, braking backward
* String#map as shortcut for #split(//).map(…).join
* True ( True === x --> true )
* False ( False === x --> false )
* Integer#even?, Integer#odd?, Integer#succ(n), Integer#pred(n)
* Enumerable/Array#imap/#ireject added, the block is instance
on each element
* Hash operators +, & and - implemented symetrically to Array#+/&/-

Bark, the bark package introduces Backward Incompatibilities in

* Putting Enumerable#grep on Steroids.
* Hash#grep reimplemented as to the above rules, but still
returning an Array.
* Hash#hgrep/vgrep/kgrep reimplemented (only difference to the
non-barking version is the usage of #grep instead of #===)
It can grep on blocks and it does not use #===, anymore when
used in the parameter form, it uses #grep instead.
#grep is aliased to #=== for backward compatible default
* Sting#each as a shortcut to split(//).each
* String#grep as a shortcut to split(//).grep(…).join
* Symbols become comparable via to_s [:b,:a,:c].sort works!!!

experimental, features I am not sure about to be tested, they might
              go away or change

PPP (Prototype Programming Paradigm ) with a sample application,
I have (small)talekd about that a lot here:

Experimental features that might change or go away in labrador/exp/*

Release 0.0.1

*  Map Magic Dot and Symbol to Method Call Delegation
   for Enumerable/Array#map and Enumerable/Array#reject

e.g. map.succ, map(:+, 2)

  • Creation of EmptyObject, EmptyProxy < EmptyObject and
    Dispatcher < EmptyProxy
  • Object#itself (def itself; self end)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs