Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is #:: method

Tags:

scala

It might be a trivial question, but I am unable to find the documentation for it:

Inside Stream, and at other places I have seen examples using the method #::. For example:

val fibs: Stream[BigInt] = BigInt(0) #:: BigInt(1) #:: fibs.zip(fibs.tail).map { n => n._1 + n._2 }

But I dont find the documentation for implicit method #:: in the api. What is it? and where is it declared?

like image 232
Jatin Avatar asked Apr 22 '26 04:04

Jatin


1 Answers

First value member of in the Stream.ConsWrapper. I found by using the symbol index on the left pane under the search box.

Here is its signature:

def #::(hd: A): Stream[A]

In few words is the List :: but for streams.

like image 60
pedrofurla Avatar answered Apr 23 '26 17:04

pedrofurla



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!