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

suggestion: curried form? #29

Closed
jondot opened this issue May 25, 2018 · 1 comment
Closed

suggestion: curried form? #29

jondot opened this issue May 25, 2018 · 1 comment

Comments

@jondot
Copy link

jondot commented May 25, 2018

Look at this beauty ❤️

from toolz import curry
from toolz.curried import pipe, map
from glom import glom

callsigns = [{'callsign':'goose'}, {'callsign':'maverick'}]

@curry
def glom_curried(spec, v):
  return glom(v, spec)



# --- userland code ---

convert_callsigns = glom_curried({'name':'callsign'})

print(pipe(callsigns,
           map(convert_callsigns),
           list))

perhaps this can be a nice API:

from glom.curried import glom
convert_callsigns = glom({'name':'callsign'})

print(pipe(callsigns,
           map(convert_callsigns),
           list))
@mahmoud
Copy link
Owner

mahmoud commented Jun 1, 2018

Hey Dotan! Definitely agree with the shorter form. I see you had a fruitful discussion over in #30, so I'm going to close this in favor of #14. Soon! :)

@mahmoud mahmoud closed this as completed Jun 1, 2018
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