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

derive ‘intercalate’ from ‘concat’, ‘empty’, and ‘reduce’ #133

Merged
merged 1 commit into from
Jan 18, 2020

Conversation

davidchambers
Copy link
Member

@syaiful6 first proposed this function in March 2017 (sanctuary-js/sanctuary#360). @masaeedu opened a pull request to add the function in June 2018 (sanctuary-js/sanctuary#569). Let's finally define intercalate in January 2020. :)

Copy link
Member

@Avaq Avaq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it! Will it replace https://sanctuary.js.org/#joinWith eventually?

@davidchambers
Copy link
Member Author

Will it replace https://sanctuary.js.org/#joinWith eventually?

Good question. I like having S.joinWith (s) as the inverse of S.splitOn (s), and I'm not opposed to including a specialization of another Sanctuary function if its type signature is significantly simpler. In fact, I believe we should add your combinators to Sanctuary: although duplicative, they would provide significant pedagogical value and (soon) useful search results.

@Avaq
Copy link
Member

Avaq commented Jan 17, 2020

they would provide significant pedagogical value and (soon) useful search results

That might work. But do we really want to increase the API surface to improve search results? Maybe for the website we could implement some sort of "search-only aliases".

  • We have the combinators that map to several existing functions
  • We have the Ramda dictionary which maps to Sanctuary functions
  • And now we have specialized functions which have been generalized and renamed

All of these could make use of a search-only mapping, where if a user types unnest or flatten they might find join, and if they type String -> Array String -> String or joinWith they might find intercalate.

@davidchambers davidchambers force-pushed the davidchambers/intercalate branch from ffded3f to a267b2f Compare January 18, 2020 15:08
@davidchambers davidchambers merged commit 843ffe9 into master Jan 18, 2020
@davidchambers davidchambers deleted the davidchambers/intercalate branch January 18, 2020 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants