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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:52:08+00:00 2026-06-01T10:52:08+00:00

Today I am writing a small program in Haskell. I found that in ghci’s

  • 0

Today I am writing a small program in Haskell. I found that in ghci’s interactive mode, this:

take 100 $ foldl (\s a -> s ++ [last s + a]) [0] (1:[6,12..])

would hang ghci and make it crash due to out of memory, but this:

take 100 $ foldl (\s a -> s ++ [last s + a]) [0] (1:[6,12..606])

could run just fine.

Why Haskell’s lazy evaluation cannot make the first one run within the memory (3G, BTW)? Or maybe it is ghci’s quirk?

Thanks for any inputs!

  • 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-01T10:52:09+00:00Added an answer on June 1, 2026 at 10:52 am

    I think your problem is this:

    foldl has some problems with infinte lists (see HaskelWiki: Fold)

    But if you try to use foldr last s will be a problem.
    Don’t know if this is a homework but I think you want to find the solution yourself, so here is a hint: instead of a fold look for a unfold – here is a example with the fibonaccis

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

Sidebar

Related Questions

So I was writing some code today that basically looks like this: string returnString
As I was writing a for loop earlier today, I thought that there must
I'm writing bug tracking software in PHP, and today I saw this in another
I'm using Kohana v3 for a web project, and today I found myself writing
Earlier today I wrote a small test app for iteratees that composed an iteratee
Basically I found myself today writing lots of code like below: #define VAL_1 0
I would like to think that some of the software I'm writing today will
Today while I was writing some code for two methods that shows and hides
Today, a fellow team member checked-in some code that looked like this var query
In writing some code today, I have happened upon a circumstance that has caused

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.