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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:58:54+00:00 2026-05-25T09:58:54+00:00

One of the biggest issues I have with haskell is to be able to

  • 0

One of the biggest issues I have with haskell is to be able to (correctly) predict the performance of haskell code. While I have some more difficult problems, I realize I have almost no understanding.

Take something simple like this:

count [] = 0
count (x:xs) = 1 + count xs 

As I understand it, this isn’t strictly a tail call (it should need to keep 1 on the stack), so looking at this definition — what can I reason about it? A count function should obviously have O(1) space requirements, but does this one? And can I be guaranteed it will or won’t?

  • 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-25T09:58:55+00:00Added an answer on May 25, 2026 at 9:58 am

    if you want to reason more easily about recursive functions, use higher order functions with known time nd space complexity. If you use foldl or foldr you know that their space complexity cannot be O(1). But if you use foldl’ from Data.List as in

    count = foldl' (\acc x -> acc + 1) 0 
    

    your function will be O(1) in space complexity as foldl’ is tail recursive per definition.

    HTH Chris

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

Sidebar

Related Questions

I have just started using thrust and one of the biggest issues I have
One of the biggest issues I have, from a UI standpoint, when building a
I've been using Markdown recently. One of my biggest problems with Markdown is that
I've written a large social networking iPhone application, and one of the biggest issues
For some Webhost issues I have to write a file backup/syncronisation tool for a
One of the biggest issues currently holding me back from diving full steam into
This has been one of the biggest obstacles in teaching new people ColdFusion. When
From my previous questions about gettext, one of the biggest benefits of using PHP's
One of my (my team's) biggest peeves with VS2008 is the slow speed in
one question about PHP Development. I am building up some Form Fields for Calculations.

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.