Method: Immutable::Queue#snoc

Defined in:
lib/immutable/queue.rb

#snoc(x) ⇒ Queue Also known as: push

Adds a new element at the end of self.

Parameters:

  • x (Object)

    the element to add.

Returns:

  • (Queue)

    a new queue.



43
44
45
# File 'lib/immutable/queue.rb', line 43

def snoc(x)
  queue(@front, Cons[x, @rear], @schedule)
end