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 new practice exercise pig-latin #691

Merged
merged 2 commits into from
May 19, 2024
Merged

Add new practice exercise pig-latin #691

merged 2 commits into from
May 19, 2024

Conversation

jiegillet
Copy link
Contributor

@jiegillet jiegillet commented May 18, 2024

This one is coming up in week 20 of 48in24.

Not the most interesting exercise, because it's all about exceptions to a weird rule, but it's not the worst either. I didn't set anything in the "practices" field because it's clearly all about strings, but we have way too many in that category already.

( String.fromList first, String.fromList second )


takeWhile : (a -> Bool) -> List a -> ( List a, List a )
Copy link
Contributor

Choose a reason for hiding this comment

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

This is picky, but I would probably rename this function. takeWhile doesn't seem to be what it is doing really. Maybe split or slice or something like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It takes the first part of a list while a condition is true. The only difference with the usual takeWhile is that it returns both parts of the list, and that's clear with the type signature. I think the name makes sense.

@jiegillet jiegillet merged commit f157ce5 into main May 19, 2024
7 checks passed
@jiegillet jiegillet deleted the jie-pig-latin branch May 19, 2024 23:38
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

Successfully merging this pull request may close these issues.

2 participants