Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combinator /: in scala

Tags:

scala

What is the meaning of this combinator in scala? /:

I've found it in several examples:

override def toString(): String = {
    ("" /: cfg) ((str: String, b: BasicBlock) => str + "Block " + b.id)
  }

or

val successorIns = b.getSuccessors().map(in(_))
val newValue = (top() /: successorIns) (meet(_, _))
like image 666
Rodrigo Avatar asked Feb 06 '23 09:02

Rodrigo


1 Answers

It is shorthand for foldLeft. You can see the definition of it here.

like image 113
2rs2ts Avatar answered Feb 19 '23 18:02

2rs2ts