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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:55:47+00:00 2026-05-13T01:55:47+00:00

When I started writing this question, I didn’t think of the easy solution with

  • 0

When I started writing this question, I didn’t think of the easy solution with nested lists, but now anyway want to find one.

Here’s an ugly code:

fun0(
    fun1(fun2(fun3(arg1))),
    fun1(fun2(fun3(arg4))),
    fun1(fun2(fun3(arg4))),
    fun1(fun2(fun3(arg4))))

Ouch! Names are given for examples. In the real application, their names have no pattern like this.

I played a bit with map(map ...) and reduce(map ...) getting wrong results or TypeErrors, before going here and writing this. The simple solution, of course, came while writing the question: use list comprehensions. Something like this (haven’t tested yet):

fun0([i(j) for i in (fun1, fun2, fun3) for j in (arg1, arg2, arg3, arg4)])

Still, I’d like to know how is it possible to achieve the same with functional programming tools only?

fun0(map(fun1, map(fun2, map(fun3,
(arg1, arg2, arg3, arg4)))))

There’s still a pattern that I think can be removed. I tried map(map, (fun1, ...), (arg1, ...)) but this way Python tried to iterate over each argument and raised errors.

  • 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-13T01:55:47+00:00Added an answer on May 13, 2026 at 1:55 am

    your 3 examples do 3 different things.

    your original is the same as

    fun0(map(lambda x:fun1(fun2(fun3(x))), [arg1,arg2,arg3,arg4])
    

    your second example, if you absolutely want a functional form, is probably something like

    fun0(map(apply, itertools.product([fun1,fun2,fun3],[arg1,arg2,arg3,arg4])))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think this question was already asked, but I couldn't find a solution which
Since I started writing this question, I think I figured out the answers to
I've recently started tinkering with ASP.NET MVC, but this question should apply to classic
Inspired by this question which started out innocently but is turning into a major
I have started writing a Macro in Visual Studio 2005 like this: Public Sub
I'm just getting started on writing functions instead of writing everything inline. Is this
When I started writing database queries I didn't know the JOIN keyword yet and
This question may sound cliched, but I am in a situation here. I am
I am aware of this question , but I believe my concerns are very
This question is motivated by something I've lately started to see a bit too

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.