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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:21:45+00:00 2026-06-16T18:21:45+00:00

In SML I must use the else part , since those are the rules

  • 0

In SML I must use the else part , since those are the rules of the language .

How can I do nothing in the else condition then ?

fun calc(input : string ) : int =

    let
      val outStr = ref "someString"
      val outInt = ref 0
    in
      outInt := (validateHelper(input) handle _ => ~1);
      if (outInt <> ~1) 
         then
            (  outStr := replaceRomanDec(input);       (* replace roman number with decimal *)
               outInt := (calcMyRomanExpression(!outStr) handle _ => ~1);
            )
         else (* nada *)

      !outInt
    end;
  • 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-16T18:21:46+00:00Added an answer on June 16, 2026 at 6:21 pm
    else ()
    

    The value () is the unique inhabitant of the unit type. It makes the whole if-then-else construct well-typed, since the then branch also has type unit.

    Finally, in some ML variants if e1 then e2 can be used as shortcut for if e1 then e2 else (), but not in SML.

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

Sidebar

Related Questions

I want to use if (condition) then Statement 1 , statement 2, ... else
I am writing this function in sml fun removeNodeswithNoIncoming((x:int,y)::xs,element:int) = if x=element then removeNodeswithNoIncoming
In SML (a functional programming language that I learned before Python), I can do
In SML 's repl , you can just type use whatever.sml and load all
I have the following to code and I use SML/NJ: signature STACK= sig type
I have the following SML code that I wrote for a class: fun lookup
I see that the SML/NJ includes a queue structure. I can't figure out how
Suppose I have a list in sml which is very big then sml shows
I have a university course about functional programming, where I use SML. As a
Background: Beginner level at SML My assignment requires me to use ListPair.foldr and only

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.