FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

implemented stack and queue in Go by henrikac · Pull Request #909 · algorithm-archivists/algorithm-archive · GitHub

implemented stack and queue in Go - #909

Open
henrikac wants to merge 1 commit into
algorithm-archivists:mainfrom
henrikac:go-stack-queue
Open

implemented stack and queue in Go#909
henrikac wants to merge 1 commit into
algorithm-archivists:mainfrom
henrikac:go-stack-queue

Conversation

henrikac commented Nov 1, 2021

Copy link
Copy Markdown
Contributor

This PR implements stack and queue in Go.

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?)

depate left a comment
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

henrikac commented Nov 2, 2021

Copy link
Copy Markdown
Contributor Author

One could think about commenting that behind the declaration to make it clear to beginners what interface{} means in this context

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 T is in Array<T> in Java.

Amaras added Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.) lang: go Go programming language labels Nov 3, 2021

Amaras commented Nov 3, 2021

Copy link
Copy Markdown
Member

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.

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.

leios commented Nov 3, 2021

Copy link
Copy Markdown
Member

@Amaras Does this PR conflict with the build system?

Amaras commented Nov 3, 2021

Copy link
Copy Markdown
Member

We haven't implemented the Go build system yet, but we need to think about the future.
It doesn't conflict with anything yet, though

henrikac commented Nov 8, 2021

Copy link
Copy Markdown
Contributor Author

@Amaras do I need to make any changes before this can get merged?

Amaras commented Nov 8, 2021

Copy link
Copy Markdown
Member

If you can compile it down to a runnable executable, it's good for me

henrikac commented Nov 8, 2021

Copy link
Copy Markdown
Contributor Author

go run stack-queue.go should work

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

Labels

Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.) lang: go Go programming language

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL