Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7776809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:58:21+00:00 2026-06-01T17:58:21+00:00

The task: I’m attempting to write a function with type signature minimum_recursive :: (a

  • 0

The task: I’m attempting to write a function with type signature minimum_recursive :: (a -> a -> Bool) -> [a] -> a . For its first parameter, it accepts a function I will call less that takes two parameters, and returns True if the first param is less than the second, False otherwise. minimum_recursive also accepts a list as its second parameter. Using explicit recursion, minimum_recursive should determine the smallest value in its input list [a].

My thinking: I was thinking to put the actual recursion in a helper function that also accepts an accumulator. I would call the helper function with the first item as the accumulator.

What I have so far: So far I have the following:

-- function as first parameter to min'
-- accepts two params, returns True if
-- first must come before second in sorted
-- order
less :: Ord a => a -> a -> Bool
less a b = a < b

-- Subpart B
minimum_recursive :: (a -> a -> Bool) -> [a] -> a
minimum_recursive func list = minimum_recursive_h func list []

I am having trouble figuring out how to even begin to write minimum_recursive_h.

Note: I know there probably is an easier way to accomplish this task, but I’m required to go about it as specified above.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:58:23+00:00Added an answer on June 1, 2026 at 5:58 pm

    You could do it like this:

    minimum_recursive _ [] = error "no minimum of empty list"
    minimum_recursive _ [x] = x
    minimum_recursive f (x:xs) = let m = minimum_recursive f xs
                                 in if f x m then x else m
    

    Or, with an accumulator:

    minimum_recursive _ [] = error "no minimum of empty list"
    minimum_recursive f (x:xs) = helper f x xs
        where
          helper _ m [] = m
          helper f m (x:xs) 
              | f m x = helper f m xs
              | otherwise = helper f x xs
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My task is to write an app(unfortunatly on C) which reads expression in infix
Your task, should you choose to accept it, is to write a Perl regular
Task: Cut or erase a file after first walk-through. i have an install file
Task: Write timestamps into MS SQL database table every second. Solutions: External application which
Task: Application written in Delphi accepts a structure ( record in terms of Delphi)
The task is to take a list of tables which is changeable. Write a
Simple task like make AJAX request , pass one parameter and return result, can
Task is simple. Have a tool which will parse CSS on network website, read
Task: have a jailbroken iPhone need to write an application which would receive notifications
The task is to retrieve parameters from session via JSTL. The session parameter name

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.