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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:12:32+00:00 2026-06-12T09:12:32+00:00

I am a beginner in SML. It’s something easy but it took like hours

  • 0

I am a beginner in SML. It’s something easy but it took like hours and yet I cant solve it.

I have to take a list of string and invert every string as well as list. and do everything without defining multiple functions outside the main. e.g. [“stack”,”overflow”,”nice”] would give [“ecin”,”wolfrevo”,”kcats”]

fun oppositelist(l)=foldl (op::) nil (map ((fn(x)=>(implode o rev o explode)(x)), l));

and the error message is:

Error: operator and operand don't agree [tycon mismatch]
  operator domain: 'Z -> 'Y
  operand:         (string -> string) * 'X
  in expression:
    map ((fn x => <exp> <exp>),l)

Don’t solve everything, if the method is wrong. Hint it. Its a homework question.

Thank You.

  • 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-12T09:12:32+00:00Added an answer on June 12, 2026 at 9:12 am

    The SML function map is curried. To map a function f over every element of the list l, you must write map f l. What you wrote is map (f,l), which means “map the function (f,l) over… something to be determined later.” The compiler is complaining at you because (f,l) is not a function ('Z -> 'Y); it’s a tuple consisting of a function and a list ((string -> string) * 'X).

    I haven’t looked any closer at your solution, but if you comment in response to this answer and ask me to, I probably will. 🙂

    EDIT: Oh, and (fn(x)=>(implode o rev o explode)(x)) is just a long-winded way of writing (implode o rev o explode), for the same reason that writing (fn(x)=>f(x)) is a long-winded way of writing f.

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

Sidebar

Related Questions

Python beginner here, I have a list of lists and want to refer to
A beginner question I am sure, but I have just started working with a
I'm a beginner in jQuery area and I have simple question like this :
Beginner iOS dev here. I have a problem in my array. Im making an
Beginner in Android development. My code crashes. I have made a simple Java method
Beginner level question Scenario: Have simple string cocantation tool, that I might expand later
Beginner question: I have a dictionary where the values are lists of (a variable
Beginner programmer here....hope it makes sense :) I have created a console app that
Beginner here, I have a simple question. In Android what would be the best
(Beginner to HTML) I have made a Photoshop mock-up of the website I want

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.