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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:23:18+00:00 2026-05-28T01:23:18+00:00

For those with suspicious minds, this is not homework, just curious. Given a finite

  • 0

For those with suspicious minds, this is not homework, just curious.

Given a finite alphabet, is it possible to construct a list of infinitely long words made from the alphabet in reverse lexographic order?

i.e. given the alphabet "ab"

is it possible to construct the list:

["aaaaaa...", "baaaaa...", "abaaaa...", "bbaaaa...", "aabaaa...", ...]

where ... represents the list (and list of lists) extending to infinite length.

A naïve attempt is:

counters alphabet = [c:ounter | ounter <- counters alphabet, c <- alphabet]

but this doesn’t work since it is left recursive.

Of course, with a working version, if you tried to print the result, you would only see the first element being printed as an infinite list of the first element from the alphabet. However, you should be able to do this:

mapM_ (print . take 2) . take 4 . counters $ "ab"

and see the output:

aa
ba
ab
bb
  • 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-28T01:23:19+00:00Added an answer on May 28, 2026 at 1:23 am

    Why not fix it?

    ghci> let bar = let foo ~(st:sts) = [c:st | c <- "ab"] ++ foo sts in fix foo
    ghci> take 5 . map (take 5) $ bar
    ["aaaaa","baaaa","abaaa","bbaaa","aabaa"]
    take 10 . map (take 5) $ bar
    ["aaaaa","baaaa","abaaa","bbaaa","aabaa","babaa","abbaa","bbbaa","aaaba","baaba"]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Those of you familar with activeadmin, you can do something like this in your
For those who are not aware, Lotus Notes is a cool system, which has
so I've been fighting with this for a few days, and I just can't
This is a .net problem with winforms, not asp.net. I have a windows form
Those of us with iPhone apps (released or unreleased) are able to send out
Those dark spinning progress dialogs in the Amazon and Engadget apps - are those
Those who invented Android and Java didn't invented for themselves. Since I started developing
For those of us that like to use the graphical version of Vim or
For those of us who use standard shared hosting packages, such as GoDaddy or
For those who like a good WPF binding challenge: I have a nearly functional

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.