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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:04:23+00:00 2026-06-03T12:04:23+00:00

Well basically, I’m having a problem, how to make a function in haskell to

  • 0

Well basically, I’m having a problem, how to make a function in haskell to work like this:
to take the first element of a string, then take the second one and compare them, then the function should continue with taking the third element from the string and comparing the second and the third one.

If it would have to compare the first two then the next two it would be easy, but I just can’t figure it out in this particular situation.

I need to achieve this step in order to write a function which if finds two neighbor elements which are the same, returns True and if there aren’t any elements like that returns False.

Thanks for any help.

  • 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-03T12:04:27+00:00Added an answer on June 3, 2026 at 12:04 pm

    A higher-order way to accomplish this (i.e. no explicit recursion) is to use zipWith to perform a point-wise comparison of the elements in the list, starting with the first, against the elements of the list, starting from the second (using tail), and then using or to collapse the point-wise results into a single result. You don’t even need to special case the empty list since zipWith is non-strict in its third argument if its second argument is the empty list.

    EDIT: Solution (hover to reveal)

    hasNeighbors as = or . zipWith (==) as $ tail as

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

Sidebar

Related Questions

well right now I basically have the jquery load function like this $('#results').load(sources.php?source=1&page=<?=$_GET['page']?>&search=<?=$_GET['search']?>); so
Does the replication system that comes with DB4O work well? Basically I would like
well basically if I write something like this - float a = 0; a
Well, how to create picture link like this up or down votes (on the
Well basically I may want to execute a script that may take as much
Well basically I am trying to pass a string to a uiwebview that just
Well basically I have this script that takes a long time to execute and
Well basically, I have this bing map control inside my Panorama view, when I
well basically it should list all the vector coords in this kind of format
Well i have a little problem but really strange. So basically i analyzed URL

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.