mardi 21 avril 2015

scala challenge - what am I missing?

Working through the 99 scala problems and confused by problem 23. To my eyes, the example is incongruent with the stated problem. Specifically the Symbol 'e in the resulting list isn't in among the input. Am I missing something?

Problem and example are as follows:

P23 (**) Extract a given number of randomly selected elements from a list.

    scala> randomSelect(3, List('a, 'b, 'c, 'd, 'f, 'g, 'h))
    res0: List[Symbol] = List('e, 'd, 'a)

    Hint: Use the solution to problem P20

Aucun commentaire:

Enregistrer un commentaire