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

  • Home
  • SEARCH
  • 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 7779041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:33:00+00:00 2026-06-01T18:33:00+00:00

val implies = fn x y = case x of false andalso case y

  • 0
val implies =
    fn x y = case x of false andalso case y of false => true
     | fn x y = case x of false andalso case y of true => true
     | fn x y = case x of true andalso case y of false => false
     | fn x y = case x of true andalso case y of true => true;  

I can’t get this to compile. I’m relatively new to SML so not quite getting the general language and syntax. What have I done wrong?

  • 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-01T18:33:01+00:00Added an answer on June 1, 2026 at 6:33 pm

    There are various things wrong:

    • There is no arguments in implies to do pattern matching directly.
    • case x of is for pattern matching with specific values, not like if/else expression which accepts boolean expressions.
    • The syntax for lambda should start with fn x => ....

    A quick fix:

    fun implies x y =
        case (x, y) of
          (false, false) => true
        | (false, true) => true
        | (true, false) => false
        | (true, true) => true
    

    which can be rewritten for readability as:

    fun implies false false = true
      | implies false true = true
      | implies true false = false
      | implies true true = true
    

    or more concise by using propositional logic rule:

    fun implies x y = (not x) orelse y
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider this code: val foo = if(true) new java.lang.Double(4) else new java.lang.Integer(4) The inferred
case class Test(kind: Int) { val ifX = if (isX) is X else not
type SQLConn = val mutable private connection : string option member this.Connection with get()
implicit val odkaz = head; def vypis(implicit odkaz:Prvek):String = { odkaz match{ case null
You have: val array = new Array[Array[Cell]](height, width) How do you initialize all elements
i have this script: val.split( /(?:,.| )+/ ) and i need to split any
val filesHere = (new java.io.File(.)).listFiles val filesHere2 = (new java.io.File(.)).listFiles scala> filesHere == filesHere2
jQuery val() didnt working, this is the simple script: $(#com_form).submit(function () { var name
Example in Unix module: val environment : unit -> string array Why not just:
In the val docs written this description: .val() Returns: String, Number, Array I tried

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.