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

R.prepend and R.append should work for strings too (String → String → String) #2418

Open
wojpawlik opened this issue Dec 24, 2017 · 7 comments

Comments

@wojpawlik
Copy link
Contributor

R.concat does work for strings.

@wojpawlik
Copy link
Contributor Author

R.concat(s) or R.concat(R.__, s) could be used instead, but I think R.prepend(s) and R.append(s) just sound better.

@wojpawlik
Copy link
Contributor Author

At least for me, they map more naturally to what I wanna do. For me, curried R.concat is less readable than equivalent arrow function.

@Bestulo
Copy link

Bestulo commented Dec 25, 2017

This, a few hours ago I spent some minutes looking for the right function for my module and the first choice in my head was to look for R.append, and then I saw that there's no such thing for strings and had to spend a few minutes remembering that it's actually called R.concat here and that it's actually inverted, so I had to invert the logic and direction of my pipes. It's a tad bit unintuitive if you ask me.

@CrossEye
Copy link
Member

I make no guarantees that it would be approved, but I would be happy to see a PR for this.

@paldepind
Copy link
Member

IMHO using concat for strings seems nicer and we already support that.

@wojpawlik
Copy link
Contributor Author

wojpawlik commented Mar 1, 2018

Just saying, changing append definition to list.concat([el]), ie. using .concat instead of _concat does enable it to concat strings due to JS's weak typing (I'm not saying that it's a good idea to rely on it). Found no similar trick for prepend.

@mulholo
Copy link

mulholo commented Jul 27, 2019

R.flip(R.concat) is a nice way of giving you both append and prepend equivalents

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

5 participants