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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:21:28+00:00 2026-05-27T18:21:28+00:00

for example: when I want to concat a list of int: [1, 2, 3]

  • 0

for example: when I want to concat a list of int: [1, 2, 3] with x my code is:

[1, 2, 3] @ [x]

but in another case I have a function that take a list is an argument,

val foo : int list

I have another function print_foo taking foo is an argument and a return type is

val print_foo : int list list

I write a function: print_foo [foo]

My question is that: [foo] in this case is accepted by type checking but is it correct in
the logical meaning? what is a good way to write this function? It is a same question for [[x]]

Could you please explain for me more about how and when I can use [x] or [[x]], etc…?

Thank you very much,

  • 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-05-27T18:21:29+00:00Added an answer on May 27, 2026 at 6:21 pm

    [x] means a list containing one element: x.

    [[x]] means a list containing one element: A list containing one element: x.

    So, if you say x is 4, then [x] = [4] is the list containing only a 4, and [[x]] = [[4]] is the list containing only a list containing only a 4.

    As you see, [x] simply puts x into a list by itself. If x = [1, 2, 3] (that is, x is a list itself), then you probably don’t want to call a function with [x] (= [[1, 2, 3]]), as you then give it a list containing your original list, rather than the list itself. Of course, this can be perfectly legitimate and needed in certain cases, but if you’re unsure, it’s most likely not needed.

    So, if you have that foo is an int list, and you then call print_foo [foo], you’re saying: “Print this list containing the list I want to print.” What you probably want to say is print_foo foo, where you leave out the redundant list wrapper. This could be interpreted as “Print this list I want to print.”

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

Sidebar

Related Questions

Is there any javascript function that can encrypt data: For example i want to
Example: Suppose in the following example I want to match strings that do not
I have created a separate class (let's call it class2.cs for example) and want
I want to understand about variables, that has been used in returning function. This
I want to create a function that has a select query inside that can
I have 2 classes: FirstDeep.cs SecondDeep.cs I did simple code for example: class FirstDeep
I have a MySQL query in which I want to include a list of
Hey, I Have three IQueryable lists which i concat together into one list to
I want to write a function that splits lists into sublists according to what
I have a function f similar to function f(str){ alert(abc+str); } Now, 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.