[ANN] Qo 0.1.6 released - RHA pattern matching added

(Brandon Weaver) #1

Added a feature for pattern matching with right hand assignment using a
guarded block implementation. If Qo matches on the left it will run the
block on the right, otherwise it skips to the next case much like pattern
matching in more functional languages:

name_longer_than_three = -> person { person.name.size > 3 }
people_with_truncated_names = people.map(&Qo.match_fn(
  Qo.m(name_longer_than_three) { |person|
    Person.new(person.name[0..2], person.age)
  Qo.m(:*) # Identity function, catch-all

# And standalone like a case:
  Qo.m(age: 10..19) { |person|
    "#{person.name} is a teen that's #{person.age} years old"
  Qo.m(:*) { |person|
    "#{person.name} is #{person.age} years old"

Documentation has also been greatly expanded. Let me know if you'd like to
see any more examples!

- baweaver