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

  • Home
  • SEARCH
  • 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 6386323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:00:38+00:00 2026-05-25T03:00:38+00:00

I have a function sqrt which takes 2 floating point values, tolerance and number

  • 0

I have a function sqrt which takes 2 floating point values, tolerance and number and gives out square root of the number within the specified tolerance. I use approximation method to do it.

let rec sqrt_rec approx tol number =
..................;;
let sqrt tol x = sqrt_rec (x/.2.0) tol x;;

I’ve another function map which takes a function and a list and applies the function to all elements of the list.

let rec map f l = 
match l with
[] -> []
| h::t -> f h::map f t;;

Now I’m trying to create another function all_sqrt which basically takes 1 floating point value, 1 floating point list and maps function sqrt to all the elements.

let all_sqrt tol_value ip_list = List.map sqrt tol_value ip_list;;

It is obviously giving me error. I tried making tol_value also a list but it still throws up error.
Error: This function is applied to too many arguments;
maybe you forgot a `;’

I believe i’m doing mapping wrong.

  • 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-05-25T03:00:39+00:00Added an answer on May 25, 2026 at 3:00 am

    The List module contains

    val map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
    

    which is used like this:

    let all_sqrt tol_value ip_list = List.map2 sqrt tol_value ip_list
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function which takes two arrays containing the tokens/words of two texts
I have a fairly complicated function that takes several double values that represent two
I have a function that gives me the following warning: [DCC Warning] filename.pas(6939): W1035
I'm trying to multicore a function (in Windows), which, at one point, calls another
I am writing an (almost) IEEE 854 compliant floating point implementation in TeX (which
I just wondered how it is possible to write a user-defined square root function
Does anyone know how the std::sqrt() function works? (or at least have an idea?)
Looking to learn function writing. I have data laid out in the following (e.g.):
I have a function which determines if an array needs to be smoothed. I
How do I use pow() and sqrt() function in Ubuntu? I have included the

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.