README.md: methodphitamine & makros. VERSION 0.1.3

This commit is contained in:
Denis Knauf 2011-11-24 11:47:03 +01:00
parent ed649d3801
commit 11128ea131
2 changed files with 44 additions and 1 deletions

View file

@ -48,6 +48,49 @@ Functional#p prints everything to stdout.
select {|i| i%5 == 2 }. select {|i| i%5 == 2 }.
to_a to_a
Thanks to `Symbol#to_proc`:
Sequence.new.to_fun.
select( &:even?).
collect {|i| i/3 }.
select( &:even?).
collect {|i| [[[[[[i.even?, i.odd?]]], i, [[[[[[i.class]]]]]]]]] }.
flatten. # It flattens everything! Not like: collect {|i| i.flatten }.
p
If you know methodphitamine, combine it:
require 'methodphitamine'
Sequence.new.to_fun.
select( &it.even?).
collect( &it/3).
select( &it.even?).
collect {|i| [[[[[[i.even?, i.odd?]]], i, [[[[[[i.class]]]]]]]]] }.
flatten.
p
(0..100000).to_fun.
collect( &it*3).
select( &it%5 == 2).
to_a
Makros
======
seq = Sequence.new.to_fun
seq = seq.select &it.even? if must_be_even
seq = seq.
collect( &it/3).
select( &it.even?).
collect {|i| [[[[[[i.even?, i.odd?]]], i, [[[[[[i.class]]]]]]]]] }
seq = seq.flatten if please_flatten
if print_it
seq.p
else
seq_to_a
end
What's with _#map_? What's with _#map_?
================= =================

View file

@ -1 +1 @@
0.1.2 0.1.3