reset password
Author Message
msargent
Posts: 519
Posted 09:49 Oct 13, 2012 |

Does anyone know what ": : :" means?  Context: Assignment 4 instructions

 def makeCodeTree(left: CodeTree, right: CodeTree) =

  Fork(left, right, chars(left) ::: chars(right), weight(left) + weight(right))
Last edited by msargent at 09:50 Oct 13, 2012.
Eric Liao
Posts: 158
Posted 12:06 Oct 13, 2012 |

 

def:::[B >: A](prefix: List[B])List[B]

Adds the elements of a given list in front of this list.

 

from the scala api website for list

rabbott
Posts: 1649
Posted 14:15 Oct 13, 2012 |

Another way of putting it is that makeCodeTree is a function that takes two code trees, left and right, and constructs a new CodeTree, which it  returns as its value. It does that by calling the Fork constructor, passing elements retrieved from left and right. As Eric said, the ::: operator means list concatenation.

Last edited by rabbott at 14:15 Oct 13, 2012.