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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:08:52+00:00 2026-06-03T21:08:52+00:00

This blogpost proposed this implementation of a curried addition function: def addN(n): return lambda

  • 0

This blogpost proposed this implementation of a curried addition function:

def addN(n):
    return lambda x: x + n

def plus(a, b):
    addA=addN(a)
    return addA(b)

I believe my version is more correct because it uses unary functions all the way.

from operator import add
plus = lambda a: lambda b: add(a, b) 
plus(1)(2)

What do you think ?

  • 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-03T21:08:55+00:00Added an answer on June 3, 2026 at 9:08 pm

    Your plus function is identical to the addN function from the blog post. The only differences are:

    1. You used a lambda where the blog post used a def.
    2. For some reason you used operator.add(a,b) instead of simply a+b.

    Usage of plus and addN will give the same results so neither one is more “correct”.

    Note that the function naming you chose is confusing since your plus function corresponds to the addN function (rather than the plus function) from the blog post.

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

Sidebar

Related Questions

In this blogpost by James Iry , he writes: Plus, Scala has an option
This blogpost and one of our senior developers at work believe that web development
i wonder what this query means: $blogPost = Doctrine_Query::create()->from('BlogPost p')->where('p.slug = ?', 'doctrine-released')->execute(); could
i use the git workflow as described in this blogpost . In short: everybody
Ok i have this function. what it should be doing it looking for pid
I have just read Joel's blogpost concerning distributed version control systems and can't understand
i have a repeating form like this: <ui:repeat var=blogPost value=#{blogPosts}> <h:form> <div class=full> <label
I am reading a blogpost at: http://flyingfrogblog.blogspot.com/2009/07/ocaml-vs-f-burrows-wheeler.html a simple implementation for Burrow Wheeler compressing
I'm using the method explained in this blogpost to create the initial populated database
According to this blogpost on android developers blog it should be doable to change

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.