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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:52:14+00:00 2026-05-27T17:52:14+00:00

So I write a function with the definition getLastDigits :: String -> String which

  • 0

So I write a function with the definition

getLastDigits :: String -> String

which finds repeating digits on the end of a String

So, for example.

getLastDigits "1000" should give "000"
getLastDigits "19990299" should give "99"

Coming from a java background I’m not quite sure how to structure this program. I’m thinking of using foldr but I’m fairly sure I can’t stop the fold half way when the repeating digits end.

-edit solved. Use the group function.

  • 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-27T17:52:14+00:00Added an answer on May 27, 2026 at 5:52 pm

    Okay then, if it is not homework:

    lastDigits :: String -> String
    lastDigits s = firstDigits . reverse $ s
      where firstDigits :: String -> String
            firstDigits (x:xs) = x : takeWhile (== x) xs
            firstDigits [] = []
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In C/C++, there is a 'write() function which let me write to either file
I want to write a function that accepts a parameter which can be either
How could I write a function with a definition something like... readBinaryFile :: Filename
I'm trying to write the Haskell function 'splitEvery' in Python. Here is it's definition:
I'm attempting to write a function which starts a thread for each contact and
I'm trying to write a program which calls a library function ( http://www.diku.dk/hjemmesider/ansatte/pisinger/3dbpp.c )
I need to write a function whose input argument should be file name, and
I am new to Haskell,I should write a function that takes a function among
You write a function and, looking at the resulting assembly, you see it can
I want to write a function in Python that returns different fixed values based

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.