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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:48:06+00:00 2026-05-23T19:48:06+00:00

Suppose we have a function like this one: foo (x, _, y) = (x,

  • 0

Suppose we have a function like this one:

foo (x, _, y) = (x, y)

What it does is, it takes a 3-tuple and returns a pair consisting of the first and third elements of the original tuple.

Now suppose we were to pass this function a 3-tuple consisting of some heavyweight objects. Would the two objects be copied to create a new tuple, or does the tuple’s internal representation contain only references to objects?

I figure that, since data in Haskell is immutable, no additional copying would be needed, but I just want to be sure.

If this behavior is implementation-defined, I’d like to know what different implementations do in such cases.

  • 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-23T19:48:07+00:00Added an answer on May 23, 2026 at 7:48 pm

    It will be references – or not even that, but just a thunk. Haskell’s lazy evaluation means it’ll basically just remove the _ from the expression that will be expanded if you ever require its value. It’s no different than basic functions like fst and snd.

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

Sidebar

Related Questions

Suppose I have a function which looks like this: template <class In, class In2>
Suppose I have a free function called InitFoo . I'd like to protect this
Suppose I have a function like this: - (NSSet *) someFunction { //code... return
Suppose I have a simple multidimensional structure, like this one: somestr<-array(sample.int(2, 120, replace=TRUE), dim=c(4,5,6))
Suppose I have a list like this one: list= [[a,123,b],[h,435,t],[w,234,j]] What I need is
Suppose I have two functions which look like this: public static void myFunction1(int a,
Suppose I have virtual function foo() in class B, and I need slightly different
Suppose I have this function: void my_test() { A a1 = A_factory_func(); A a2(A_factory_func());
Suppose you have the following function foo . When I'm running a for loop,
suppose i have a query like this : $std_id = $_POST['std_id']; $name = $_POST['name'];

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.