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

The ratio of blue marbles to redmarbles in a bag is 11:9. If there are 99 blue marbles, in the bag, how many red marblesare there?
Gabriella wants to tile a room with an area of 320 square feet. The width of the room is 4/5 its length. What are the length and width of the room?
Gabriella wants to tile a room with an area of 320 square feet. The width of the room is 4/5 its length. What are the length and width of the room?
A writing workshop enrolls novelists and poets in a ratio of 5:3.  There are 24 people at the workshop.  How many novelists are there?  How many poets are there
if y=6x and x=1.5 find y
At the veterinarian's office, 4 animals out of every 5 seen were cats. A total of 35 animals were seen.a. How many cats were seen?b. The ratio of male cats seen
What are some advantages of using less farm machinery in planting?
Help me please >.< ---------------------
Why was the time period between 1865 and 1900 called the Gilded Age?
if y=6x and x=1.5 find y