Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion slides/body/lect-w07-seq.tex
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@
def sort[T: Ordering](xs: Seq[T]): Seq[T] = xs.sorted // mer om Ordering sen

def freq[T](xs: Seq[T]): Seq[(T, Int)] =
xs.distinct.map((_, xs.count(_ == x)))
xs.distinct.map(x => x -> xs.count(_ == x))
\end{Code}
\pause
Standardbibliotekets metoder försöker ordna så att det blir samma konkreta typ in som ut, men ibland väljs annan lämplig konkret samling, t.ex. kan en \code{Array} bli en \code{ArrayBuffer}.
Expand Down