danco8m9aLiseomie danco8m9aLiseomie
  • 15-12-2016
  • Computers and Technology
contestada

Write and test the definition of a haskell function 'largest', which finds the largest element of a list, but is implemented using higher-order functions and/or operator sections as appropriate.

Respuesta :

miden miden
  • 15-12-2016
largest :: [a] -> (a -> a -> Ordering) -> a largest (x:xs) cmp = go x xs where go largest [] = largest go largest (x:xs) = case cmp largest x of LT -> go x xs _ -> go largest xs

Answer Link

Otras preguntas

what are the 5 key features of tornado phenomenon?
how do you say i love dogs in french
after 25% of a bill is paid $80 still remains to be paid. how much was the bill?
What is the solution to the proportion?  X/45=8/18 Answers: A. X=16 B. X=20 C. X=35 D. X=101.25
what is 1.36,1.3 and 1.63 from least to greatest
what is 6.46,6.41 and 4.6 in order from least to greatest
What was the Black Death TRULY caused by?
Which sentence uses possessive personal pronouns correctly? A. The squirrel twitched it's tail back and forth. B. Their's is the one on the right, under the
A restaurant chain ordered 3945 pounds of rice in 20 pound bags. About how many 20 pound bags of rice did the chain ordered ?
The volume of a cube is 512 cm3. What would change if the volume of the cube were measured in cubic meters?