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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:47:44+00:00 2026-06-11T15:47:44+00:00

Can a pointfree function return a tuple? For instance, can the following be written

  • 0

Can a pointfree function return a tuple? For instance, can the following be written in pointfree style (where f1, f2, and f3 have been defined):

(\t -> (f1 t, f2 t, f3 t))

In this case, my f1, f2, and f3 are compositions of quot, mod, *, and some integers.

(\f1,f2,f3 -> (\t -> (f1 t, f2 t, f3 t)))

is a more general case, and is equivalent to

(\f1,f2,f3,t -> (f1 t, f2 t, f3 t))

Named functions are OK, but my examples are anonymous. (Named examples would be as follows)

f x = (f1 x, f2 x, f3 x)
f f1 f2 f3 x = (f1 x, f2 x, f3 x)

EDIT: I’m just curious for fun, I’m not going to do this.

  • 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-11T15:47:45+00:00Added an answer on June 11, 2026 at 3:47 pm

    You can write

    (\t -> (f1 t, f2 t, f3 t))
    

    pointfree, it’s

    liftM (,,) f1 `ap` f2 `ap` f3
    

    with ap from Control.Monad and the Monad instance of (->) a from Control.Monad.Instances. A somewhat more readable form may be the Control.Applicative variant

    (,,) <$> f1 <*> f2 <*> f3
    

    You can then further point-free

    (\f1 f2 f3 -> (\t -> (f1 t, f2 t, f3 t)))
    

    As

      \f1 f2 f3 -> (,,) <$> f1 <*> f2 <*> f3
    = \f1 f2 -> ((,,) <$> f1 <*> f2 <*>)
    = \f1 f2 -> (<*>) ((,,) <$> f1 <*> f2)
    = \f1 f2 -> ((<*>) . ((,,) <$> f1 <*>)) f2
    = \f1 -> (<*>) . ((,,) <$> f1 <*>)
    = \f1 -> (<*>) . (<*>) ((,,) <$> f1)
    = \f1 -> (((<*>) .) . (<*>) . (<$>) (,,)) f1
    = ((<*>) .) . (<*>) . (<$>) (,,)
    

    but seriously, you shouldn’t. Keep it readable, that means a bit of pointfreeing is good, but don’t overdo it.

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

Sidebar

Related Questions

Can anyone give me an example of how to return the following json simply
Can somebody help me convert this VB function to Perl (PHP, Ruby or Python
So I have the following: <div id=TwoColumns> <div id=LeftColumn> <div id=navigation> /*This is a
Can I order my users in the database, so I don't have to say
Can someone thoroughly explain the last line of the following code: def myMethod(self): #
Can I be sure about the order in a Python dictionary? The function op.GetTangent(id)
Can anyone explain to me why this program: for(float i = -1; i <
This question is related to this Function Composition VS Function Application which answered by
Can anyone tell me how to open Auto CAD file in HTML5? Is this
Can someone tell me why the following does not match: >>> re.search(r'(\d{2, 10})', '153')

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.