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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:40:27+00:00 2026-06-17T08:40:27+00:00

let p = let x = 1 in x + 1, let y =

  • 0

let p = let x = 1 in x + 1, let y = 2 in y + 1, 4

Since comma , have the lowest precedence, I would image p has 3 elements: (2, 3, 4).

But in fact, p has only 2 elements: (2, (3, 4))

Why?

Why the last , belongs to let y expression, but not outside of it?

  • 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-17T08:40:28+00:00Added an answer on June 17, 2026 at 8:40 am

    I would expect let...in... to have the following syntax

    let binding = expression in expression

    and the block goes as far to the right as possible.

    In your example, the OCaml parser expects

    let y = 2 in y + 1, 4
    

    to be an expression and parses it as (3, 4) successfully.

    An equivalent of your example with explicit brackets is

    let p = (let x = 1 in x + 1, (let y = 2 in y + 1, 4))
    

    If you would like to return final result (2, 3, 4), you should put a bracket to stop let...in... block in the appropriate place:

    let p = let x = 1 in x + 1, (let y = 2 in y + 1), 4
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say i'm trying to allocate 100 bytes, but since I don't have 100
Let's say I don't have photoshop, but I want to make pattern files (.pat)
let's say I have a variable containing an integer or a float (since integers
I have a bunch of Users . Since Django doesn't really let me extend
Let's say I have an object that is fairly complex. Since it is so
Let's say I have a table called Event which has a to-many relationship with
I have a file on disk that's only 168MB. It's just a comma separated
(Since i have a database predefined i can't let EF recreate it). This the
It's been years since I have done C++ let alone ATL code I have
Let's say you have a bunch of documents hosted on your webserver but you

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.