Module: RubyHDL::High::HEnumerable
- Included in:
- Expression
- Defined in:
- lib/HDLRuby/std/sequencer_sw.rb
Overview
Module adding functionalities to object including the +heach+ method.
Instance Method Summary collapse
-
#hall?(arg = nil, &ruby_block) ⇒ Boolean
Tell if all the elements respect a given criterion given either as +arg+ or as block.
-
#hany?(arg = nil, &ruby_block) ⇒ Boolean
Tell if any of the elements respects a given criterion given either as +arg+ or as block.
-
#hchain(arg) ⇒ Object
Returns an HEnumerator generated from current enumerable and +arg+.
-
#hchunk(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby chunk.
-
#hchunk_while(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby chunk_while.
-
#hcompact ⇒ Object
HW implementation of the Ruby compact, but remove 0 values instead on nil (since nil that does not have any meaning in HW).
-
#hcount(obj = nil, &ruby_block) ⇒ Object
WH implementation of the Ruby count.
-
#hcycle(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby cycle.
-
#hdrop(n) ⇒ Object
HW implementation of the Ruby drop.
-
#hdrop_while(&ruby_block) ⇒ Object
HW implementation of the Ruby drop_while.
-
#heach_cons(n, &ruby_block) ⇒ Object
HW implementation of the Ruby each_cons.
-
#heach_entry(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby each_entry.
-
#heach_range(rng, &ruby_block) ⇒ Object
Iterator on each of the elements in range +rng+.
-
#heach_slice(n, &ruby_block) ⇒ Object
HW implementation of the Ruby each_slice.
-
#heach_with_index(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby each_with_index.
-
#heach_with_object(obj, &ruby_block) ⇒ Object
HW implementation of the Ruby each_with_object.
-
#hfind(if_none_proc, &ruby_block) ⇒ Object
HW implementation of the Ruby find.
-
#hfind_index(obj = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby find_index.
-
#hfirst(n = 1) ⇒ Object
HW implementation of the Ruby first.
-
#hflat_map(&ruby_block) ⇒ Object
HW implementation of the Ruby flat_map.
-
#hgrep(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby grep.
-
#hgrep_v(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby grep_v.
-
#hgroup_by(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby group_by.
-
#hinclude?(obj) ⇒ Boolean
HW implementation of the Ruby include?.
-
#hinject(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby inject.
-
#hlazy(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby lazy.
-
#hmap(&ruby_block) ⇒ Object
Returns a vector containing the execution result of the given block on each element.
-
#hmax(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby max.
-
#hmax_by(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby max_by.
-
#hmin(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby min.
-
#hmin_by(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby min_by.
-
#hminmax(&ruby_block) ⇒ Object
HW implementation of the Ruby minmax.
-
#hminmax_by(&ruby_block) ⇒ Object
HW implementation of the Ruby minmax_by.
-
#hnone?(arg = nil, &ruby_block) ⇒ Boolean
Tell if none of the elements respects a given criterion given either as +arg+ or as block.
-
#hone?(arg = nil, &ruby_block) ⇒ Boolean
Tell if one and only one of the elements respects a given criterion given either as +arg+ or as block.
-
#hpartition(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby partition.
-
#hreduce(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby reduce.
-
#hreject(&ruby_block) ⇒ Object
HW implementatiob of the Ruby reject.
-
#hreverse_each(*args, &ruby_block) ⇒ Object
HW implementatiob of the Ruby reverse_each.
-
#hselect(&ruby_block) ⇒ Object
HW implementation of the Ruby select.
-
#hslice_after(pattern = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby slice_after.
-
#hslice_before(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby slice_before.
-
#hslice_when(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby slice_when.
-
#hsort(&ruby_block) ⇒ Object
HW implementation of the Ruby sort.
-
#hsort_by(&ruby_block) ⇒ Object
HW implementation of the Ruby sort.
-
#hsum(initial_value = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby sum.
-
#htake(n) ⇒ Object
The HW implementation of the Ruby take.
-
#htake_while(&ruby_block) ⇒ Object
The HW implementation of the Ruby take_while.
-
#htally(h = nil) ⇒ Object
HW implementation of the Ruby tally.
-
#hto_a ⇒ Object
HW implementation of the Ruby to_a.
-
#hto_h(h = nil) ⇒ Object
HW implementation of the Ruby to_h.
-
#huniq(&ruby_block) ⇒ Object
HW implementation of the Ruby uniq.
-
#hzip(obj, &ruby_block) ⇒ Object
HW implementation of the Ruby zip.
Instance Method Details
#hall?(arg = nil, &ruby_block) ⇒ Boolean
Tell if all the elements respect a given criterion given either as +arg+ or as block.
610 611 612 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 610 def hall?(arg = nil,&ruby_block) self.heach.hall?(arg,&ruby_block) end |
#hany?(arg = nil, &ruby_block) ⇒ Boolean
Tell if any of the elements respects a given criterion given either as +arg+ or as block.
616 617 618 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 616 def hany?(arg = nil,&ruby_block) self.heach.hany?(arg,&ruby_block) end |
#hchain(arg) ⇒ Object
Returns an HEnumerator generated from current enumerable and +arg+
621 622 623 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 621 def hchain(arg) self.heach.hchain(arg) end |
#hchunk(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby chunk. NOTE: to do, or may be not.
627 628 629 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 627 def hchunk(*args,&ruby_block) raise "hchunk is not supported yet." end |
#hchunk_while(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby chunk_while. NOTE: to do, or may be not.
633 634 635 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 633 def hchunk_while(*args,&ruby_block) raise "hchunk_while is not supported yet." end |
#hcompact ⇒ Object
HW implementation of the Ruby compact, but remove 0 values instead on nil (since nil that does not have any meaning in HW).
654 655 656 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 654 def hcompact self.heach.hcompact(&ruby_block) end |
#hcount(obj = nil, &ruby_block) ⇒ Object
WH implementation of the Ruby count.
660 661 662 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 660 def hcount(obj = nil, &ruby_block) self.heach.hcount(obj,&ruby_block) end |
#hcycle(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby cycle.
665 666 667 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 665 def hcycle(n = nil,&ruby_block) self.heach.hcycle(n,&ruby_block) end |
#hdrop(n) ⇒ Object
HW implementation of the Ruby drop.
677 678 679 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 677 def hdrop(n) self.heach.sdrop(n) end |
#hdrop_while(&ruby_block) ⇒ Object
HW implementation of the Ruby drop_while.
682 683 684 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 682 def hdrop_while(&ruby_block) self.heach.sdrop_while(n) end |
#heach_cons(n, &ruby_block) ⇒ Object
HW implementation of the Ruby each_cons
687 688 689 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 687 def heach_cons(n,&ruby_block) self.heach.heach_cons(n,&ruby_block) end |
#heach_entry(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby each_entry. NOTE: to do, or may be not.
693 694 695 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 693 def heach_entry(*args,&ruby_block) raise "heach_entry is not supported yet." end |
#heach_range(rng, &ruby_block) ⇒ Object
Iterator on each of the elements in range +rng+. NOTE:
- Stop iteration when the end of the range is reached or when there are no elements left
- This is not a method from Ruby but one specific for hardware where creating a array is very expensive.
604 605 606 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 604 def heach_range(rng,&ruby_block) self.heach.heach_range(rng,&ruby_block) end |
#heach_slice(n, &ruby_block) ⇒ Object
HW implementation of the Ruby each_slice
698 699 700 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 698 def heach_slice(n,&ruby_block) self.heach.heach_slice(n,&ruby_block) end |
#heach_with_index(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby each_with_index.
703 704 705 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 703 def heach_with_index(*args,&ruby_block) self.heach.hwith_index(*args,&ruby_block) end |
#heach_with_object(obj, &ruby_block) ⇒ Object
HW implementation of the Ruby each_with_object.
708 709 710 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 708 def heach_with_object(obj,&ruby_block) self.heach.hwith_object(obj,&ruby_block) end |
#hfind(if_none_proc, &ruby_block) ⇒ Object
HW implementation of the Ruby find. NOTE: contrary to Ruby, if_none_proc is mandatory since there is no nil in HW. Moreover, the argument can also be a value.
672 673 674 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 672 def hfind(if_none_proc, &ruby_block) self.seach.hfind(if_non_proc,&ruby_block) end |
#hfind_index(obj = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby find_index.
723 724 725 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 723 def hfind_index(obj = nil, &ruby_block) self.heach.hfind_index(obj,&ruby_block) end |
#hfirst(n = 1) ⇒ Object
HW implementation of the Ruby first.
728 729 730 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 728 def hfirst(n=1) self.heach.hfirst(n) end |
#hflat_map(&ruby_block) ⇒ Object
HW implementation of the Ruby flat_map. NOTE: actually due to the way HDLRuby handles vectors, should work like smap
648 649 650 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 648 def hflat_map(&ruby_block) self.heach.hflat_map(&ruby_block) end |
#hgrep(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby grep. NOTE: to do, or may be not.
734 735 736 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 734 def hgrep(*args,&ruby_block) raise "hgrep is not supported yet." end |
#hgrep_v(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby grep_v. NOTE: to do, or may be not.
740 741 742 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 740 def hgrep_v(*args,&ruby_block) raise "hgrep_v is not supported yet." end |
#hgroup_by(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby group_by. NOTE: to do, or may be not.
746 747 748 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 746 def hgroup_by(*args,&ruby_block) raise "hgroup_by is not supported yet." end |
#hinclude?(obj) ⇒ Boolean
HW implementation of the Ruby include?
751 752 753 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 751 def hinclude?(obj) return self.heach.hinclude?(obj) end |
#hinject(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby inject.
756 757 758 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 756 def hinject(*args,&ruby_block) return self.heach.hinject(*args,&ruby_block) end |
#hlazy(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby lazy. NOTE: to do, or may be not.
767 768 769 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 767 def hlazy(*args,&ruby_block) raise "hlazy is not supported yet." end |
#hmap(&ruby_block) ⇒ Object
Returns a vector containing the execution result of the given block on each element. If no block is given, return an HEnumerator. NOTE: be carful that the resulting vector can become huge if there are many element.
641 642 643 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 641 def hmap(&ruby_block) self.heach.hmap(&ruby_block) end |
#hmax(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby max.
772 773 774 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 772 def hmax(n = nil, &ruby_block) return self.heach.hmax(n,&ruby_block) end |
#hmax_by(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby max_by.
777 778 779 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 777 def hmax_by(n = nil, &ruby_block) return self.heach.hmax_by(n,&ruby_block) end |
#hmin(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby min.
782 783 784 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 782 def hmin(n = nil, &ruby_block) return self.heach.hmin(n,&ruby_block) end |
#hmin_by(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby min_by.
787 788 789 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 787 def hmin_by(n = nil, &ruby_block) return self.heach.hmin_by(n,&ruby_block) end |
#hminmax(&ruby_block) ⇒ Object
HW implementation of the Ruby minmax.
792 793 794 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 792 def hminmax(&ruby_block) return self.heach.hminmax(&ruby_block) end |
#hminmax_by(&ruby_block) ⇒ Object
HW implementation of the Ruby minmax_by.
797 798 799 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 797 def hminmax_by(&ruby_block) return self.heach.hminmax_by(&ruby_block) end |
#hnone?(arg = nil, &ruby_block) ⇒ Boolean
Tell if none of the elements respects a given criterion given either as +arg+ or as block.
803 804 805 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 803 def hnone?(arg = nil,&ruby_block) return self.heach.hnone?(arg,&ruby_block) end |
#hone?(arg = nil, &ruby_block) ⇒ Boolean
Tell if one and only one of the elements respects a given criterion given either as +arg+ or as block.
809 810 811 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 809 def hone?(arg = nil,&ruby_block) return self.heach.hone?(arg,&ruby_block) end |
#hpartition(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby partition. NOTE: to do, or may be not.
815 816 817 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 815 def hpartition(*args,&ruby_block) raise "hpartition is not supported yet." end |
#hreduce(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby reduce.
761 762 763 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 761 def hreduce(*args,&ruby_block) return self.heach.hreduce(*args,&ruby_block) end |
#hreject(&ruby_block) ⇒ Object
HW implementatiob of the Ruby reject.
820 821 822 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 820 def hreject(&ruby_block) return self.heach.hreject(&ruby_block) end |
#hreverse_each(*args, &ruby_block) ⇒ Object
HW implementatiob of the Ruby reverse_each.
825 826 827 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 825 def hreverse_each(*args,&ruby_block) return self.heach.hreverse_each(*args,&ruby_block) end |
#hselect(&ruby_block) ⇒ Object
HW implementation of the Ruby select.
718 719 720 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 718 def hselect(&ruby_block) self.heach.hselect(&ruby_block) end |
#hslice_after(pattern = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby slice_after. NOTE: to do, or may be not.
831 832 833 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 831 def hslice_after(pattern = nil,&ruby_block) raise "hslice_after is not supported yet." end |
#hslice_before(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby slice_before. NOTE: to do, or may be not.
837 838 839 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 837 def hslice_before(*args,&ruby_block) raise "hslice_before is not supported yet." end |
#hslice_when(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby slice_when. NOTE: to do, or may be not.
843 844 845 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 843 def hslice_when(*args,&ruby_block) raise "hslice_before is not supported yet." end |
#hsort(&ruby_block) ⇒ Object
HW implementation of the Ruby sort.
848 849 850 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 848 def hsort(&ruby_block) return self.heach.hsort(&ruby_block) end |
#hsort_by(&ruby_block) ⇒ Object
HW implementation of the Ruby sort.
853 854 855 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 853 def hsort_by(&ruby_block) return self.heach.hsort_by(&ruby_block) end |
#hsum(initial_value = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby sum.
858 859 860 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 858 def hsum(initial_value = nil,&ruby_block) return self.heach.hsum(initial_value,&ruby_block) end |
#htake(n) ⇒ Object
The HW implementation of the Ruby take.
863 864 865 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 863 def htake(n) return self.heach.htake(n) end |
#htake_while(&ruby_block) ⇒ Object
The HW implementation of the Ruby take_while.
868 869 870 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 868 def htake_while(&ruby_block) return self.heach.htake_while(&ruby_block) end |
#htally(h = nil) ⇒ Object
HW implementation of the Ruby tally. NOTE: to do, or may be not.
874 875 876 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 874 def htally(h = nil) raise "htally is not supported yet." end |
#hto_a ⇒ Object
HW implementation of the Ruby to_a.
713 714 715 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 713 def hto_a self.heach.hto_a end |
#hto_h(h = nil) ⇒ Object
HW implementation of the Ruby to_h. NOTE: to do, or may be not.
880 881 882 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 880 def hto_h(h = nil) raise "hto_h is not supported yet." end |
#huniq(&ruby_block) ⇒ Object
HW implementation of the Ruby uniq.
885 886 887 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 885 def huniq(&ruby_block) return self.heach.huniq(&ruby_block) end |
#hzip(obj, &ruby_block) ⇒ Object
HW implementation of the Ruby zip. NOTE: for now szip is deactivated untile tuples are properly handled by HDLRuby.
892 893 894 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 892 def hzip(obj,&ruby_block) return self.heach.hzip(obj,&ruby_block) end |