Module: RubyHDL::High::SEnumerable
- Defined in:
- lib/HDLRuby/std/sequencer_sw.rb
Overview
Module adding functionalities to object including the +seach+ method.
Instance Method Summary collapse
-
#sall?(arg = nil, &ruby_block) ⇒ Boolean
Tell if all the elements respect a given criterion given either as +arg+ or as block.
-
#sany?(arg = nil, &ruby_block) ⇒ Boolean
Tell if any of the elements respects a given criterion given either as +arg+ or as block.
-
#schain(arg) ⇒ Object
Returns an SEnumerator generated from current enumerable and +arg+.
-
#schunk(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby chunk.
-
#schunk_while(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby chunk_while.
-
#scompact ⇒ Object
HW implementation of the Ruby compact, but remove 0 values instead on nil (since nil that does not have any meaning in HW).
-
#scount(obj = nil, &ruby_block) ⇒ Object
WH implementation of the Ruby count.
-
#scycle(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby cycle.
-
#sdrop(n) ⇒ Object
HW implementation of the Ruby drop.
-
#sdrop_while(&ruby_block) ⇒ Object
HW implementation of the Ruby drop_while.
-
#seach_cons(n, &ruby_block) ⇒ Object
HW implementation of the Ruby each_cons.
-
#seach_entry(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby each_entry.
-
#seach_nexts(num, &ruby_block) ⇒ Object
Iterator on the +num+ next elements.
-
#seach_range(rng, &ruby_block) ⇒ Object
Iterator on each of the elements in range +rng+.
-
#seach_slice(n, &ruby_block) ⇒ Object
HW implementation of the Ruby each_slice.
-
#seach_with_index(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby each_with_index.
-
#seach_with_object(obj, &ruby_block) ⇒ Object
HW implementation of the Ruby each_with_object.
-
#sfind(if_none_proc, &ruby_block) ⇒ Object
HW implementation of the Ruby find.
-
#sfind_index(obj = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby find_index.
-
#sfirst(n = 1) ⇒ Object
HW implementation of the Ruby first.
-
#sflat_map(&ruby_block) ⇒ Object
HW implementation of the Ruby flat_map.
-
#sgrep(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby grep.
-
#sgrep_v(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby grep_v.
-
#sgroup_by(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby group_by.
-
#sinclude?(obj) ⇒ Boolean
HW implementation of the Ruby include?.
-
#sinject(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby inject.
-
#slazy(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby lazy.
-
#smap(&ruby_block) ⇒ Object
Returns a vector containing the execution result of the given block on each element.
-
#smax(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby max.
-
#smax_by(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby max_by.
-
#smin(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby min.
-
#smin_by(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby min_by.
-
#sminmax(&ruby_block) ⇒ Object
HW implementation of the Ruby minmax.
-
#sminmax_by(&ruby_block) ⇒ Object
HW implementation of the Ruby minmax_by.
-
#snone?(arg = nil, &ruby_block) ⇒ Boolean
Tell if none of the elements respects a given criterion given either as +arg+ or as block.
-
#sone?(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.
-
#spartition(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby partition.
-
#sreduce(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby reduce.
-
#sreject(&ruby_block) ⇒ Object
HW implementatiob of the Ruby reject.
-
#sreverse_each(*args, &ruby_block) ⇒ Object
HW implementatiob of the Ruby reverse_each.
-
#sselect(&ruby_block) ⇒ Object
HW implementation of the Ruby select.
-
#sslice_after(pattern = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby slice_after.
-
#sslice_before(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby slice_before.
-
#sslice_when(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby slice_when.
-
#ssort(&ruby_block) ⇒ Object
HW implementation of the Ruby sort.
-
#ssort_by(&ruby_block) ⇒ Object
HW implementation of the Ruby sort.
-
#ssort_merge(arI, arO, first, middle, last, &ruby_block) ⇒ Object
Merge two arrays in order, for ssort only.
-
#ssum(initial_value = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby sum.
-
#stake(n) ⇒ Object
The HW implementation of the Ruby take.
-
#stake_while(&ruby_block) ⇒ Object
The HW implementation of the Ruby take_while.
-
#stally(h = nil) ⇒ Object
HW implementation of the Ruby tally.
-
#sto_a ⇒ Object
HW implementation of the Ruby to_a.
-
#sto_h(h = nil) ⇒ Object
HW implementation of the Ruby to_h.
-
#suniq(&ruby_block) ⇒ Object
HW implementation of the Ruby uniq.
-
#szip(obj, &ruby_block) ⇒ Object
HW implementation of the Ruby zip.
Instance Method Details
#sall?(arg = nil, &ruby_block) ⇒ Boolean
Tell if all the elements respect a given criterion given either as +arg+ or as block.
185 186 187 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 185 def sall?(arg = nil,&ruby_block) self.seach.sall?(arg,&ruby_block) end |
#sany?(arg = nil, &ruby_block) ⇒ Boolean
Tell if any of the elements respects a given criterion given either as +arg+ or as block.
191 192 193 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 191 def sany?(arg = nil,&ruby_block) self.seach.sany?(arg,&ruby_block) end |
#schain(arg) ⇒ Object
Returns an SEnumerator generated from current enumerable and +arg+
196 197 198 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 196 def schain(arg) self.seach.schain(arg) end |
#schunk(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby chunk. NOTE: to do, or may be not.
202 203 204 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 202 def schunk(*args,&ruby_block) raise "schunk is not supported yet." end |
#schunk_while(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby chunk_while. NOTE: to do, or may be not.
208 209 210 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 208 def schunk_while(*args,&ruby_block) raise "schunk_while is not supported yet." end |
#scompact ⇒ Object
HW implementation of the Ruby compact, but remove 0 values instead on nil (since nil that does not have any meaning in HW).
229 230 231 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 229 def scompact self.seach.scompact(&ruby_block) end |
#scount(obj = nil, &ruby_block) ⇒ Object
WH implementation of the Ruby count.
235 236 237 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 235 def scount(obj = nil, &ruby_block) self.seach.scount(obj,&ruby_block) end |
#scycle(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby cycle.
240 241 242 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 240 def scycle(n = nil,&ruby_block) self.seach.scycle(n,&ruby_block) end |
#sdrop(n) ⇒ Object
HW implementation of the Ruby drop.
252 253 254 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 252 def sdrop(n) self.seach.sdrop(n) end |
#sdrop_while(&ruby_block) ⇒ Object
HW implementation of the Ruby drop_while.
257 258 259 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 257 def sdrop_while(&ruby_block) self.seach.sdrop_while(n) end |
#seach_cons(n, &ruby_block) ⇒ Object
HW implementation of the Ruby each_cons
262 263 264 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 262 def seach_cons(n,&ruby_block) self.seach.seach_cons(n,&ruby_block) end |
#seach_entry(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby each_entry. NOTE: to do, or may be not.
268 269 270 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 268 def seach_entry(*args,&ruby_block) raise "seach_entry is not supported yet." end |
#seach_nexts(num, &ruby_block) ⇒ Object
Iterator on the +num+ next elements. 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.
482 483 484 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 482 def seach_nexts(num,&ruby_block) return self.seach.snexts(num,&ruby_block) end |
#seach_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.
179 180 181 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 179 def seach_range(rng,&ruby_block) self.seach.seach_range(rng,&ruby_block) end |
#seach_slice(n, &ruby_block) ⇒ Object
HW implementation of the Ruby each_slice
273 274 275 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 273 def seach_slice(n,&ruby_block) self.seach.seach_slice(n,&ruby_block) end |
#seach_with_index(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby each_with_index.
278 279 280 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 278 def seach_with_index(*args,&ruby_block) self.seach.swith_index(*args,&ruby_block) end |
#seach_with_object(obj, &ruby_block) ⇒ Object
HW implementation of the Ruby each_with_object.
283 284 285 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 283 def seach_with_object(obj,&ruby_block) self.seach.swith_object(obj,&ruby_block) end |
#sfind(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.
247 248 249 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 247 def sfind(if_none_proc, &ruby_block) self.seach.sfind(if_non_proc,&ruby_block) end |
#sfind_index(obj = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby find_index.
298 299 300 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 298 def sfind_index(obj = nil, &ruby_block) self.seach.sfind_index(obj,&ruby_block) end |
#sfirst(n = 1) ⇒ Object
HW implementation of the Ruby first.
303 304 305 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 303 def sfirst(n=1) self.seach.sfirst(n) end |
#sflat_map(&ruby_block) ⇒ Object
HW implementation of the Ruby flat_map. NOTE: actually due to the way HDLRuby handles vectors, should work like smap
223 224 225 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 223 def sflat_map(&ruby_block) self.seach.sflat_map(&ruby_block) end |
#sgrep(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby grep. NOTE: to do, or may be not.
309 310 311 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 309 def sgrep(*args,&ruby_block) raise "sgrep is not supported yet." end |
#sgrep_v(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby grep_v. NOTE: to do, or may be not.
315 316 317 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 315 def sgrep_v(*args,&ruby_block) raise "sgrep_v is not supported yet." end |
#sgroup_by(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby group_by. NOTE: to do, or may be not.
321 322 323 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 321 def sgroup_by(*args,&ruby_block) raise "sgroup_by is not supported yet." end |
#sinclude?(obj) ⇒ Boolean
HW implementation of the Ruby include?
326 327 328 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 326 def sinclude?(obj) return self.seach.sinclude?(obj) end |
#sinject(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby inject.
331 332 333 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 331 def sinject(*args,&ruby_block) return self.seach.sinject(*args,&ruby_block) end |
#slazy(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby lazy. NOTE: to do, or may be not.
342 343 344 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 342 def slazy(*args,&ruby_block) raise "slazy is not supported yet." end |
#smap(&ruby_block) ⇒ Object
Returns a vector containing the execution result of the given block on each element. If no block is given, return an SEnumerator. NOTE: be carful that the resulting vector can become huge if there are many element.
216 217 218 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 216 def smap(&ruby_block) self.seach.smap(&ruby_block) end |
#smax(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby max.
347 348 349 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 347 def smax(n = nil, &ruby_block) return self.seach.smax(n,&ruby_block) end |
#smax_by(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby max_by.
352 353 354 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 352 def smax_by(n = nil, &ruby_block) return self.seach.smax_by(n,&ruby_block) end |
#smin(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby min.
357 358 359 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 357 def smin(n = nil, &ruby_block) return self.seach.smin(n,&ruby_block) end |
#smin_by(n = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby min_by.
362 363 364 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 362 def smin_by(n = nil, &ruby_block) return self.seach.smin_by(n,&ruby_block) end |
#sminmax(&ruby_block) ⇒ Object
HW implementation of the Ruby minmax.
367 368 369 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 367 def sminmax(&ruby_block) return self.seach.sminmax(&ruby_block) end |
#sminmax_by(&ruby_block) ⇒ Object
HW implementation of the Ruby minmax_by.
372 373 374 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 372 def sminmax_by(&ruby_block) return self.seach.sminmax_by(&ruby_block) end |
#snone?(arg = nil, &ruby_block) ⇒ Boolean
Tell if none of the elements respects a given criterion given either as +arg+ or as block.
378 379 380 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 378 def snone?(arg = nil,&ruby_block) return self.seach.snone?(arg,&ruby_block) end |
#sone?(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.
384 385 386 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 384 def sone?(arg = nil,&ruby_block) return self.seach.sone?(arg,&ruby_block) end |
#spartition(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby partition. NOTE: to do, or may be not.
390 391 392 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 390 def spartition(*args,&ruby_block) raise "spartition is not supported yet." end |
#sreduce(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby reduce.
336 337 338 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 336 def sreduce(*args,&ruby_block) return self.seach.sreduce(*args,&ruby_block) end |
#sreject(&ruby_block) ⇒ Object
HW implementatiob of the Ruby reject.
395 396 397 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 395 def sreject(&ruby_block) return self.seach.sreject(&ruby_block) end |
#sreverse_each(*args, &ruby_block) ⇒ Object
HW implementatiob of the Ruby reverse_each.
400 401 402 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 400 def sreverse_each(*args,&ruby_block) return self.seach.sreverse_each(*args,&ruby_block) end |
#sselect(&ruby_block) ⇒ Object
HW implementation of the Ruby select.
293 294 295 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 293 def sselect(&ruby_block) self.seach.sselect(&ruby_block) end |
#sslice_after(pattern = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby slice_after. NOTE: to do, or may be not.
406 407 408 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 406 def sslice_after(pattern = nil,&ruby_block) raise "sslice_after is not supported yet." end |
#sslice_before(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby slice_before. NOTE: to do, or may be not.
412 413 414 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 412 def sslice_before(*args,&ruby_block) raise "sslice_before is not supported yet." end |
#sslice_when(*args, &ruby_block) ⇒ Object
HW implementation of the Ruby slice_when. NOTE: to do, or may be not.
418 419 420 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 418 def sslice_when(*args,&ruby_block) raise "sslice_before is not supported yet." end |
#ssort(&ruby_block) ⇒ Object
HW implementation of the Ruby sort.
428 429 430 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 428 def ssort(&ruby_block) return self.seach.ssort(&ruby_block) end |
#ssort_by(&ruby_block) ⇒ Object
HW implementation of the Ruby sort.
433 434 435 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 433 def ssort_by(&ruby_block) return self.seach.ssort_by(&ruby_block) end |
#ssort_merge(arI, arO, first, middle, last, &ruby_block) ⇒ Object
Merge two arrays in order, for ssort only.
423 424 425 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 423 def ssort_merge(arI, arO, first, middle, last, &ruby_block) return self.seach.ssort_merge(arI,arO,first,middle,last,&ruby_block) end |
#ssum(initial_value = nil, &ruby_block) ⇒ Object
HW implementation of the Ruby sum.
438 439 440 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 438 def ssum(initial_value = nil,&ruby_block) return self.seach.ssum(initial_value,&ruby_block) end |
#stake(n) ⇒ Object
The HW implementation of the Ruby take.
443 444 445 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 443 def stake(n) return self.seach.stake(n) end |
#stake_while(&ruby_block) ⇒ Object
The HW implementation of the Ruby take_while.
448 449 450 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 448 def stake_while(&ruby_block) return self.seach.stake_while(&ruby_block) end |
#stally(h = nil) ⇒ Object
HW implementation of the Ruby tally. NOTE: to do, or may be not.
454 455 456 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 454 def stally(h = nil) raise "stally is not supported yet." end |
#sto_a ⇒ Object
HW implementation of the Ruby to_a.
288 289 290 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 288 def sto_a self.seach.sto_a end |
#sto_h(h = nil) ⇒ Object
HW implementation of the Ruby to_h. NOTE: to do, or may be not.
460 461 462 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 460 def sto_h(h = nil) raise "sto_h is not supported yet." end |
#suniq(&ruby_block) ⇒ Object
HW implementation of the Ruby uniq.
465 466 467 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 465 def suniq(&ruby_block) return self.seach.suniq(&ruby_block) end |
#szip(obj, &ruby_block) ⇒ Object
HW implementation of the Ruby zip. NOTE: for now szip is deactivated untile tuples are properly handled by HDLRuby.
472 473 474 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 472 def szip(obj,&ruby_block) return self.seach.szip(obj,&ruby_block) end |