From a33c7cf3776594a8222366b1d995d0478edf2f04 Mon Sep 17 00:00:00 2001 From: Joel Kaasinen Date: Sat, 19 Jun 2021 22:17:14 +0300 Subject: [PATCH] Set 4a Ex 5: reword, add challenge --- exercises/Set4a.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/exercises/Set4a.hs b/exercises/Set4a.hs index b32ad92..4eb9b03 100644 --- a/exercises/Set4a.hs +++ b/exercises/Set4a.hs @@ -82,14 +82,16 @@ rangeOf :: [a] -> a rangeOf = todo ------------------------------------------------------------------------------ --- Ex 5: given a list of lists, return the longest list. If there --- are multiple lists of the same length, return the list that has --- the smallest _first element_. +-- Ex 5: given a (non-empty) list of (non-empty) lists, return the longest +-- list. If there are multiple lists of the same length, return the list that +-- has the smallest _first element_. -- -- (If multiple lists have the same length and same first element, -- you can return any one of them.) -- --- Give the longest function a suitable type. +-- Give the function "longest" a suitable type. +-- +-- Challenge: Can you solve this exercise without sorting the list of lists? -- -- Examples: -- longest [[1,2,3],[4,5],[6]] ==> [1,2,3]