Challenge submission#1
Open
rafaelbeckel wants to merge 21 commits intostakingrewards:backendfrom
Open
Conversation
Merry Christmas! I started this today and decided to use Rust, because I've been reading about it for a while but haven't built a program yet. This will be my first try.
At this point, we have a basic table that holds cells objects in a hash map. No calculations of formulas yet, we just print the raw cell contents in stdout. The idea is that the map keys will hold a String reference of the cell, as "A1", "B2", etc. This will make it easy to search them and iterate, so they can reference each other quite trivially. Each cell will hold a lexer and a parser (to be implemented), so the strings will be converted to an internal syntax tree and calculated.
Rust compiler makes it impossible to create circular references or data races, which introduces a big challenge on building data structures that are common in other languages. Because of the ownership model, referencing a shared pointer requires the knowledge of all types of Rust smart pointers, the subtle differences between them, and when each one is suitable. In the end, it was a RefCell wrapped in a Reference Counter, a case that should be avoided if possible, which I tried hard to achieve, but our program is one of such cases where a RefCell is required because we manage shared references to data that can be changed at runtime.
removes thiserror lib and the custom errors file in favor of ad-hoc errors with anyhow
The evaluator is done. I'll finish up cleaning up the tests tomorrow.
it fails with the main challenge, though, because of stack overflow. I'll debug it and allocate the necessary parts to the heap
I finally fixed the Stack Overflow and implemented all the test cases. The result goes beyond the challenge and implements ranges, lte and pretty formatting as well. It took a while, but I'm proud of it.
…dule to expression
rafaelbeckel
commented
Jan 13, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is my final submission. I'll write more details as a comment or edit this description later.
The solution is working and fully functional.
How to run it:
From Docker
From MacOS with Apple Silicon (M1 or M2)
From Rust
Running all test cases (40)