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

Add option to generate a function #1

Open
danielo515 opened this issue Dec 20, 2018 · 6 comments
Open

Add option to generate a function #1

danielo515 opened this issue Dec 20, 2018 · 6 comments

Comments

@danielo515
Copy link

Hello, thank you for this macro. It is very useful because I really think that there is no need for a new syntax for something as simple as this.
However, there is a feature that I wish this macro has: being able to define new functions using the pipe macro. I use functional programming a lot, and one way to create point free functions is by piping several of them. If this macro provides that it will be perfect for almost any use case.

Regards

@Andarist
Copy link
Owner

Could u give an example of the input & output?

@danielo515
Copy link
Author

danielo515 commented Dec 20, 2018

Sure! Basically for point free function composition

Input

const normalize = pipe(capitalize, camelCase, trim) 

Output

const normalize = (... args) => 
trim(camelCase(capitalize(... args))) 

@Andarist
Copy link
Owner

That would make a good pipe.macro. At first it was going to be this macro's name but then I thought about your use case and thought I'd better name it pipeline.macro.

When I get some free time in following days I might create the other one.

@danielo515
Copy link
Author

Oh, Thank you for thinking on the future ourselves! 😄
To be honest, I didn't even noticed your macro was pipeline instead of pipe!

@danielo515
Copy link
Author

Hello again @Andarist ,
I just created a small macro that does what we have been discussing. Is basically a fork of yours with some small changes.
If you want to publish if yourself (at the end is based on your work) I can provide you the code.
If you are Ok with it, I can fork your project and publish it under the pipe name.

Whatever you prefer.

Regards

@Andarist
Copy link
Owner

I don't mind you forking this project and adjusting it to create pipe.macro - you could even fork it once again later to create compose.macro 😅

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