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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:24:50+00:00 2026-05-27T14:24:50+00:00

countSequences :: Int -> Int -> Integer countSequences 0 m = 0 countSequences m

  • 0
countSequences :: Int -> Int -> Integer

countSequences 0 m = 0
countSequences m 0 = 0
countSequences (n) (m) =  if (n <= (m+1)) then (truncate((cee (m+1) (n) (0))) + truncate((countSequences (fromIntegral (n-1)) (fromIntegral (m))))) 
else truncate(countSequences (fromIntegral (n-1)) (fromIntegral (m)))

factorial :: Float -> Float
factorial 0 = 1
factorial 1 = 1
factorial x = x * factorial(x-1)

cee :: Float -> Float -> Float -> Float

cee x y z = if (x==y) then ((1) / (factorial ((x+z)-(y)))) else ((x) * (cee (x-1) (y) (z+1)))

i cant really understand why this error keep coming up .. the truncate is supposed to convert the type from Float to Integer so ..

  • 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-27T14:24:50+00:00Added an answer on May 27, 2026 at 2:24 pm

    m is of type Int (per your type signature for countSequences: hence, so is m + 1. However, your function cee expects a Float, so the type checker righteously complains.

    Furthermore, you will need a couple of more fixes to make this type check. Here’s a version that passes the checker:

    countSequences :: Int -> Int -> Integer
    countSequences 0 m = 0
    countSequences m 0 = 0
    countSequences n m =
      if   n <=  m + 1
      then truncate $
             cee (fromIntegral (m+1)) (fromIntegral n) 0 +
             fromIntegral (countSequences (n-1) m)
      else countSequences (n-1) m
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I understand correctly, then foo1() fails to unlock &private_value_. As a result, foo2()'s
I really dont know if this is possible or not. But I am strucking
I have the following code: int main() { int n = 3, m =
I have a class named Entry declared like this: class Entry{ string Id {get;set;}
Are there any consequences if I installed Drupal into the /drupal directory, and then
i'm trying understand what are consequences of enabling compression for web service response. Web
Leaving cursor open is known as a bad practice. But what really happens when
If I have a simple Groovy class such as class Address { Integer streetNumber
This seems like a simple problem, but it is not intuitive to me. Say
This is the basic example from hbm-style nhibernate. http://ayende.com/blog/2327/multi-table-entities-in-nhibernate public class Person { public

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.