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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:14:28+00:00 2026-06-02T04:14:28+00:00

I would like to insert a int into the correct position in the sorted

  • 0

I would like to insert a int into the correct position in the sorted list. for example if I insert 2 it would in insert in the second position.

insert :: Int -> [Int] -> [Int
insert x [] = [x]
insert x (y:ys) = if xsy 
                 then x:y:ys else y insert x ys 

can anyone point what’s wrong.
thanks

  • 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-02T04:14:30+00:00Added an answer on June 2, 2026 at 4:14 am

    Like Daniel Fischer says, you just have a few typos:

    • xsy should presumably be x < y.

    • You have a missing operator in y insert x ys; what operator do you need to prepend a value to a list? (Hint: You use it when pattern-matching the list.)

    • You missed a ] after [Int.

    • Your indentation is wrong; then should be aligned at least as far as the if, and the else should be on a new line, aligned with then. If you’re indenting with tabs, you should set your editor to indent with spaces instead (or, if you must, set it to display tabs as 8 spaces, which is what Haskell expects).

    Other than that, you’re good to go.

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

Sidebar

Related Questions

I would like to insert the output of multiple calculations into my text document:
I would like to insert a new DataGridViewRow into my DataGridView at a specific
I would like to put an int into a string . This is what
I would like to insert some data into an Access Database. DataTable dt =
I would like to insert the appropriate value into my foreign key TennisClubId... But
I would like to insert a new node into my Tree. I develop with
I would like to find a quick method for debugging a insert-select statement. Example:
I would like to insert in a table some pieces of code. For example:
I would like to know how to insert TIME into SQL Server using C#
I would like to do a insert into using a select, but I know

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.