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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:28:32+00:00 2026-06-07T21:28:32+00:00

I write program for searching in index list of tuple by binary search I

  • 0

I write program for searching in index list of tuple by binary search I write and work fine

superBubble::(Ord t) =>[[t]]->[[t]]
superBubble a=map bubbleSort a
combining::[BookInfo]->[Int]
combining books= bubbleSort(map index books)  
 binsearch :: [Int] -> Int -> Int -> Int -> Int -- list, value, low, high, return int
 binsearch xs value low high
  | high < low       = -1
  | xs!!mid > value  = binsearch xs value low (mid-1)
  | xs!!mid < value  = binsearch xs value (mid+1) high
  | otherwise        = mid
   where
   mid = low + ((high - low) `div` 2)
  final::[BookInfo]->Int->Int->Int->Int 
  final vs key s r= binsearch concat( combining vs) key s r

and the other functions work propaply but when i add it to the hole give me an error

the error is unexcpted ‘|’ the first one but why?

  • 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-07T21:28:33+00:00Added an answer on June 7, 2026 at 9:28 pm

    The lines from binsearch :: are indented one more space than the lines before it. Unindent each of those lines by one space.

    Additionally, the lines from final:: onwards are indented two more spaces than the initial lines. Unindent each of these lines by two spaces.

    Finally, as Daniel points out, you have a -< in your final:: line, instead of a ->. (Which you have now corrected in your posted code, thus confusing anyone who looks at this question in future.)


    Correct code:

    superBubble::(Ord t) =>[[t]]->[[t]]
    superBubble a=map bubbleSort a
    combining::[BookInfo]->[Int]
    combining books= bubbleSort(map index books)  
    binsearch :: [Int] -> Int -> Int -> Int -> Int -- list, value, low, high, return int
    binsearch xs value low high
     | high < low       = -1
     | xs!!mid > value  = binsearch xs value low (mid-1)
     | xs!!mid < value  = binsearch xs value (mid+1) high
     | otherwise        = mid
      where
      mid = low + ((high - low) `div` 2)
    final::[BookInfo]->Int->Int->Int->Int 
    final vs key s r= binsearch concat( combining vs) key s r
    

    (And you need to include definitions of bubbleSort, BookInfo and index as well.)


    Why is your indentation an error?

    Because it makes binsearch look as if it is part of the value of combining, instead of a separate function. The first | is the first character that can’t possibly be part of an expression.

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

Sidebar

Related Questions

I write program for Windows CE that should work with Serial ports. I use
My program is searching in list of tuples I wrote it as the following
I'm willing to write program that after 5 sec shows text that was hidden
If I write program in python 2.7 and I want to run another script
Write a program to determine whether a computer is big-endian or little-endian. bool endianness()
I write a program to delete a file from somewhere of my harddisk in
I write a program to verify this website: www.alipay.com which root CA cert should
I want to write a program in Prolog that confirms if a b-tree of
I want to write a program to contact a PHP script online, and show
I need to write a program that prints 0.(03) for input 1 and 33.

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.