Class: Ramda::Internal::Transducers::DropRepeatsTransducer

Inherits:
Object
  • Object
show all
Defined in:
lib/ramda/internal/transducers/drop_repeats_transducer.rb

Overview

Removes repeats from list

Instance Method Summary collapse

Instance Method Details

#call(reducer) ⇒ Object

No arguments



7
8
9
10
11
12
13
14
15
# File 'lib/ramda/internal/transducers/drop_repeats_transducer.rb', line 7

def call(reducer)
  lambda do |acc, x|
    if acc.any? && acc.last == x
      acc
    else
      reducer.call(acc, x)
    end
  end
end