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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:42:11+00:00 2026-06-12T14:42:11+00:00

So, I am working on a function that takes two lists already in order

  • 0

So, I am working on a function that takes two lists already in order from smallest to biggest and merge them in way that they are both sorted. My thinking was to split the second list into head and tail, use insert to sort the head into the first list, and run the function again. However upon running I get:

Couldn't match expected type `[t0]' with actual type `[a0] -> [a0]'
    In the return type of a call of `List.insert'
    Probable cause: `List.insert' is applied to too few arguments

I am a bit confused as to how I should solve this, here is the code:

combsort((x:xs):(y:ys)) = combsort(List.insert(y (x:xs)) : ys)
combsort((x:xs):[]) = []
  • 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-12T14:42:12+00:00Added an answer on June 12, 2026 at 2:42 pm

    You have one set of parentheses too many,

    combsort((x:xs):(y:ys)) = combsort(List.insert(y (x:xs)) : ys)
    

    should be

    combsort ((x:xs):(y:ys)) = combsort (List.insert y (x:xs) : ys)
    

    Note that function application doesn’t need parentheses.

    In your original, the List.insert(y (x:xs)) is parsed as List.insert applied to the result of applying y to the list (x:xs), like

    List.insert foo
      where
        foo = y (x:xs)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to write a function in lisp that takes two lists of pairs
Hello there i've written a small functions that takes two lists and compares them
I'm working with a PHP function that takes a string and converts all of
Hey, I was working with a PHP function that takes multiple arguments and formats
I am working with datetime objects in python. I have a function that takes
I'm working on a function that handles events from a number of buttons and
I am working on a function that will essentially see which of two ints
I have a simple javascript function that takes two variables. I need to pass
I have been looking for an elegant way to write a function that takes
I'm practicing Haskell, and writing a summation function that takes in two numbers (upper

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.