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

feat: add words function to standard library #75

Merged
merged 9 commits into from
May 23, 2024

Conversation

kilianc
Copy link
Contributor

@kilianc kilianc commented May 22, 2024

working on tests

@kilianc kilianc marked this pull request as ready for review May 22, 2024 14:50
@Ph0enixKM
Copy link
Collaborator

The branch does not pass the tests. It seems that the function inserts an additional new line symbol in the end of the string

Screenshot 2024-05-22 at 17 30 54

@kilianc kilianc marked this pull request as draft May 22, 2024 16:05
@kilianc
Copy link
Contributor Author

kilianc commented May 22, 2024

Ty for letting me know, I also wonder if we should just slightly refactor split and then have words be split(a, ' ')

src/std/main.ab Outdated Show resolved Hide resolved
src/std/main.ab Outdated Show resolved Hide resolved
@kilianc
Copy link
Contributor Author

kilianc commented May 22, 2024

pub fun words(text: Text): [Text] {
  return split(text, " ")
}

@Ph0enixKM
Copy link
Collaborator

Yeah that would be interesting to see if we can do that. I tried to code the split function properly in bash in a relatively efficient way, but couldn't get it right.

src/std/main.ab Outdated Show resolved Hide resolved
Co-authored-by: Phoenix Himself <pkaras.it@gmail.com>
src/std/main.ab Outdated Show resolved Hide resolved
@kilianc
Copy link
Contributor Author

kilianc commented May 22, 2024

Yeah that would be interesting to see if we can do that. I tried to code the split function properly in bash in a relatively efficient way, but couldn't get it right.

I tried locally and it works by just calling split, which version do you want to merge?

@Ph0enixKM
Copy link
Collaborator

I tried locally and it works by just calling split, which version do you want to merge?

Oh then let's merge the one with split - it's much cleaner

src/std/main.ab Outdated Show resolved Hide resolved
src/std/main.ab Outdated Show resolved Hide resolved
src/std/main.ab Outdated Show resolved Hide resolved
@kilianc kilianc marked this pull request as ready for review May 22, 2024 22:57
Copy link
Collaborator

@Ph0enixKM Ph0enixKM left a comment

Choose a reason for hiding this comment

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

LGTM

@Ph0enixKM Ph0enixKM merged commit 6c3b5a1 into amber-lang:master May 23, 2024
1 check passed
@kilianc kilianc deleted the patch-1 branch May 23, 2024 20:08
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.

None yet

2 participants