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 Practice Exercise: wordy #250

Closed
0xNeshi opened this issue Sep 6, 2024 · 4 comments · Fixed by #296
Closed

Add Practice Exercise: wordy #250

0xNeshi opened this issue Sep 6, 2024 · 4 comments · Fixed by #296
Assignees
Labels
x:action/create Work on something from scratch x:module/practice-exercise Work on Practice Exercises x:rep/large Large amount of reputation x:type/coding Write code that is not student-facing content (e.g. test-runners, generators, but not exercises) x:type/content Work on content (e.g. exercises, concepts)

Comments

@0xNeshi
Copy link
Contributor

0xNeshi commented Sep 6, 2024

Problem specification:
https://github.com/exercism/problem-specifications/tree/main/exercises/wordy

TODO:

@0xNeshi 0xNeshi added x:action/create Work on something from scratch x:module/practice-exercise Work on Practice Exercises x:size/medium Medium amount of work x:type/coding Write code that is not student-facing content (e.g. test-runners, generators, but not exercises) x:type/content Work on content (e.g. exercises, concepts) x:rep/large Large amount of reputation and removed x:size/medium Medium amount of work labels Sep 6, 2024
@Ephraim-nonso
Copy link
Contributor

Let me take this.

@Ephraim-nonso
Copy link
Contributor

Hi @0xNeshi

I've been facing some difficulty manipulating strings especially in the area of comparing a fraction of sentence. In the meantime, can I take another task that I can quickly solve the practice exercise.

Just wanted to update you on the progress of this particular issue.

@0xNeshi
Copy link
Contributor Author

0xNeshi commented Oct 7, 2024

@Ephraim-nonso imo the most straightforward solution is Go's, and it being fairly imperative, it is the most easily translated to Cairo.

You can always split a sentence into words with the following pseudocode:

words = []
current_word = ""
for ch in string {
    if ch != empty_space {
        // in Cairo, use ByteArray::append_byte to convert ASCII number to actual ByteArray char
        current_word += ch 
    } else {
        // we got to the end of the current word, we can append it to the array
        words.append(current_word)
        current_word = ""
    }
}
words.append(current_word) // last "word" should be the '?' char, and we append it as well

After this, the algorithm is pretty much the same is in Go's implementation and string comparison should be easier as well.
It's not particularly clever, but it doesn't have to be. We aim for ease of understanding and idiomatic Cairo code.


If you still think you'd like to work on something else, I think the easiest tasks would be to add Concept exercises, they are mostly at the top of the issues list. You can choose any other issue to work on as well, there are still many other practice exercises and even some concepts to be written as well. Let me know what you'd like to work on, and I'll reassign you.

@Ephraim-nonso
Copy link
Contributor

Alright. I'd revisit while putting this into consideration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:action/create Work on something from scratch x:module/practice-exercise Work on Practice Exercises x:rep/large Large amount of reputation x:type/coding Write code that is not student-facing content (e.g. test-runners, generators, but not exercises) x:type/content Work on content (e.g. exercises, concepts)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants