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

Define a map function (like for, but non-monadic) #2083

Open
RyanGlScott opened this issue Jul 31, 2024 · 1 comment
Open

Define a map function (like for, but non-monadic) #2083

RyanGlScott opened this issue Jul 31, 2024 · 1 comment

Comments

@RyanGlScott
Copy link
Contributor

Currently, SAWScript offers a for function for iterating over a list in a monadic fashion:

for : {m, a, b} [a] -> (a -> m b) -> m [b]

For many use cases, however, it would be more convenient to iterate over a list without needing a monad m. For these scenarios, we should offer a map function:

map : {a, b} (a -> b) -> [a] -> [b]

SAWScript does not currently offer this, but it could easily be added.

@sauclovian-g
Copy link
Contributor

sauclovian-g commented Jul 31, 2024

FWIW, you can find here a bunch of other list ops needed on another project that are (AFAIK) not and maybe should be in the standard library.

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

No branches or pull requests

2 participants