Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic partials? #5

Open
mvirts opened this issue Dec 27, 2021 · 1 comment
Open

Automatic partials? #5

mvirts opened this issue Dec 27, 2021 · 1 comment

Comments

@mvirts
Copy link

mvirts commented Dec 27, 2021

Make calls that are missing args into partials? Create a new singleton sentinel NoArg to signify a missing arg to a partial. If you can create "NoArg", then you can make args that have no default always default to NoArg.

a = print(NoArg,end="\n\n-said the cat\n")
a("Meow. Feed Me.")
#Meow. Feed Me.
#
#-said the cat

def b(animal,sound):
    print(f"{animal} goes {sound}")

c = b("Cat")
c("Meow") 
#Cat goes Meow
c("Purr") 
#Cat goes Purr
@cgccuser
Copy link

cgccuser commented Jan 7, 2022

Could this feature be called "Automatic currying" instead? I feel like calling them partials could be a bit confusing because of the mathematical interpretation of partial functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants