thealgorithms / nim Goto Github PK
View Code? Open in Web Editor NEWCollection of various algorithms implemented in Nim for educational purposes.
License: MIT License
Collection of various algorithms implemented in Nim for educational purposes.
License: MIT License
I do not like very much the "All algorithms implemented in Nim" description. I prefer something along the lines of:
"Collection of various algorithms implemented in Nim for educational purposes." similar to the C++ repository description which is more explicit and less conceited.
We could also add a link to the documentation of the project, which will be the object of a future issue.
We might want to add more tags to the description. We can already add educational
, interview-questions
and more like mathematics
, string
, as we add more code examples.
There's a script to build the DIRECTORY.md
file. However, there's no workflow or anything that creates it automatically.
The users won't be able to see a list of algorithms. There's also a broken link in the readme.
I propose to create a GitHub Actions workflow to build it automatically on every push (not pull_request
as this could mess up the PR branch) if there are any changes.
With protected branches, there's no way to push directly, but a pull request can be created by GitHub Actions, and then reviewed by the maintainers.
What do you think about this? π
https://the-algorithms.com/language/nim
The directory.nim script should not appear here, nor any future scripts.
There is this new style formatter nph proposed by @arnetheduck that could be used in place of nimpretty.
What do you think?
@ZoomRmc proposed a script to automatically fetch the names of the different algorithms implementations.
This script does not detect the catalan_numbers.nim file in the dynamic programming directory.
I would accept any PR that partially fix these algorithm's detection issues.
At this moment, in some cases setting the default gc
/mm
setting for the compiler results in a compilation error.
The workaround for this is moving the setting to the nim.cfg
file. Having an additional configuration file is not great, so as soon as the fix for the bug lands in stable the setting should be moved back to the config.nims
and nim.cfg
should be removed.
This is a PR that sould have fixed the issue: nim-lang/Nim#19455. Not sure why we're still hitting it.
At some point we should add this to main website, for a ref PR we can see how zig was added: https://github.com/TheAlgorithms/website/pull/225/files
the only issue I see is that of highlighting, I imagine the two will not have Nim support (zig was highlighted as rustβ¦)
@Panquesito7 previously added a CI action to open a pull request each time a contribution is made, to update the directory.md file.
It appears to do nothing right now.
I guess that the newly created DIRECTORY.md file is not detected when added.
The repository was recently created, so we need people that are proficient and experienced in the Nim programming language.
Anyone interested, feel free to comment here and contribute to our repository.
Thanks for your interest! π
Currently, CI fails due to the linear search algorithm.
There is an issue with the recursive algorithm for string arrays.
proc recursiveLinearSearch*[T](arr: openArray[T], key: T, idx: Nat = arr.low.Nat): OptNat=
# Recursion is another method for linear search.
# Recursive calls replace the for loop.
# `none(Natural)` is returned when the array is traversed completely
# and no key is matched, or when `arr` is empty.
if idx > arr.high:
return none(Natural)
if arr[idx] == key:
return some(idx)
echo idx, " ", arr[idx], " ", key
recursiveLinearSearch(arr, key, idx + 1)
for the test:
var arr = ["0", "c", "a", "u", "5", "7"]
check recursiveLinearSearch(arr, "5") == some(Natural(4))
outputs:
0 5
1 5
2 5
3 5
4 5
5 5
Expected output:
0 0 5
1 c 5
2 a 5
3 u 5
We could maybe fix it by converting the example test array to a sequence:
var arr = @["0", "c", "a", "u", "5", "7"]
In the README.md
file, there's a badge that links to the contributing guidelines.
However, that link is pointing to the master
branch, which doesn't exist. It still redirects you, but I still think we should update that to use the correct branch name.
Steps to contribute
fix_badge_link
.README.md
file.Contributions Welcome
. Update the link to point to the main
branch instead of the master
branch.If you need any help, let us know! π
This is a good first issue. Please leave it open to first-time contributors and beginners.
Currently the testcase "Search in a string array matching with a string matching value" is failing, returning None
, due to openArray of arr
resolving to array of empty strings, inside the recursive search it's ["", "", "", "", "", ""]
.
Changing the arr
to const
or to a variable seq
(instead of array) fixes execution.
I'll try to investigate and post an upstream issue.
The contributing guidelines link directly to the DIRECTORY.md
file, to make it easier for other people to find the algorithm list.
However, the given link is incorrect and is not working, which should be immediately fixed.
Steps to contribute
fix_directory_link
.CONTRIBUTING.md
file.directory.md
with DIRECTORY.md
.directory.md
with DIRECTORY.md
.If you need any help with this, let us know about it. π
This is a good first issue. Please leave it open to first-time contributors and beginners.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.