-
-
Notifications
You must be signed in to change notification settings - Fork 356
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
implemented stack and queue in Go #909
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
I like the use of the empty interface to make it more general.
One could think about commenting that behind the declaration to make it clear to beginners what interface{}
means in this context, but maybe Leios wants to decide here.
Note: code/go/stack-queue.goalso includes a func main where all the tests are written but I'm not sure where to include these (or if they are even required?)
The code is able to run with go run stack-queue.go
on its own that way, that's enough. It doesn't need to be embedded somewhere. One could move the "test code" into a separate function and call it in main()
that's how it's sometimes done, e.g. Monte Carlo and others. But that's not a must either, I think.
I'm all for making comments in the code if there is some part of an algorithm that can be difficult to understand but I am not a fan of making comments describing language syntax, e.g. what |
We want to produce executables (as much as possible for all compiled languages) with the build system in construction, so I am not sure this point is valid right now. |
@Amaras Does this PR conflict with the build system? |
We haven't implemented the Go build system yet, but we need to think about the future. |
@Amaras do I need to make any changes before this can get merged? |
If you can compile it down to a runnable executable, it's good for me |
|
This PR implements stack and queue in Go.
Note:
code/go/stack-queue.go
also includes afunc main
where all the tests are written but I'm not sure where to include these (or if they are even required?)