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 7552247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:42:46+00:00 2026-05-30T10:42:46+00:00

In the following code, the where value= clause returns a partially applied function. How

  • 0

In the following code, the where value= clause returns a partially applied function.

How can I ensure it gets fully applied?

------------------------------
future_value :: Float -> Float -> Float -> Float
future_value present interest periods =
  (present * (( 1 + interest) ** periods))

------------------------------
-- Given an initial amount
-- Given a yearly fee, as well as a yearly interest...
-- Calculates return over a number of years, given a yearly fee.
return_over_time :: Float -> Float -> Float -> Float -> Float
return_over_time present interest num_years fee =
  if num_years == 1 then (future_value  present interest 1.0) - fee
  else future_value value
       where value =  return_over_time present interest (num_years - 1) fee
  • 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-30T10:42:47+00:00Added an answer on May 30, 2026 at 10:42 am

    The issue isn’t with value but with future_value. future_value takes three arguments but you only give it one (value), so future_value value has the type Float -> Float - > Float. value, on the other hand, is just a Float because return_over_time is fully applied in the where clause.

    You can make sure future_value is fully applied by passing in two more floats for interest and periods.

    Incidentally, is there any particular reason you are using Float instead of Double?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Try the following code: s = '#value#' puts s.gsub('#value#', Regexp.escape('*')) # => '\*' puts
How do i get the identity. The following code enters a value into orderItem.
The following code raises an ambiguous reference to value at compile time: import flash.display.Sprite;
I have the following code to assign a value to all the elements of
I have the following code: UPDATE myTable SET Col1 = @Value However, I have
I'm using the following code to update a DataGridView's cell value. This is called
I have following code that does not work due to a being a value
The following code: class MyClass(): def test(self): self.__x = 0 def __setattr__(self, name, value):
The xmlns attribute in the following code stops me getting the value I need.
I have the following code: var tempIdx = document.getElementById('cityBuild').selectedIndex; var tempBuilding = document.getElementById('cityBuild').options[tempIdx].value; //

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.