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

Create most used functions lib #6

Open
murilocamargos opened this issue Apr 14, 2018 · 10 comments
Open

Create most used functions lib #6

murilocamargos opened this issue Apr 14, 2018 · 10 comments

Comments

@murilocamargos
Copy link
Collaborator

There's a lot of problems in Project Euler that relies on the same kind of operations, e.g., prime testing, prime generator, fibonacci sequence, and so on. It would be nice to have these kind of functions in file shared by all solutions as a lib.

What you guys think about that?

@FrankKair
Copy link
Owner

Hey, @murilocamargos.
I think this is a nice idea. Maybe we could have a directory on the root of the project called libs/ or helpers/. Which one do you guys prefer?

And in that case, we should always strive for the most performant and efficient algorithms possible, since we'll be relying on these functions for the other problems.

What do you think, @fredericojordan?

@FrankKair
Copy link
Owner

I created this pull request with an example in Elixir. Is this sort of what we want?

#9

@fredericojordan
Copy link
Collaborator

fredericojordan commented Apr 17, 2018

Although it's nice to have these functions readily available, I think that coming up with them is part of the fun.
Designing your own algorithm and trying to optimize it's implementation for the problem in hand is what I like the most about these problems! 🙃

@murilocamargos
Copy link
Collaborator Author

This would be only the most used functions. From what I've seen solving some problems, having a function for checking if a number is prime or not wasn't a decisive factor to actually solve the problem. Also, I think having a helpers file doesn't stop you from optimizing them as well, this would actually be encouraged!

@FrankKair
Copy link
Owner

Well, I guess we can sort of be in the middle on this one.

We can have the directory but everyone is free to use whatever algorithm they want, given that the answer is correct.

How does that sound?

@FrankKair
Copy link
Owner

What is nice about this is that we can discuss the algorithms out of the context of the problems.
Like, should someone open an pull request for Fibonacci, we'd discuss a way to maximise its performance and all.
That way, this repo could also be used to discuss and learn algorithms 😊

@fredericojordan
Copy link
Collaborator

Sure! Why not?

@caiangums
Copy link
Collaborator

Can I join the discussion?

I think what is nice when you finish your problem is looking at the forum and trying to find someone that thought what you done before you even started the Project. My point is: I think we can create a directory inside the project with some categories.
If you like to know how to find a fibonacci number in Elixir you can search on docs/fibonacci/.
If you want some prime testing function in Python, you can go on docs/primes/ and search for something inside.

Nevertheless at my point of view this should be well documented. Copy and paste code is never fun as understand how that code works and what's going on with the code that you just saw and we can compare 'same stuff' on different languages.

@fredericojordan
Copy link
Collaborator

My only issue with this idea is that sometimes there are slightly different goals in each problem. For example, let's say one problem needs the fibonacci number at certain index while the other only has to generate them continuously.
There will be cases where one implementation works best in a specific problem and some other implementation works best for a second problem.
Having a lib do that for you would either have to take this in consideration or wouldn't be of much use.

@caiangums
Copy link
Collaborator

Specific to the case that you(@fredericojordan) described, finding a Fibonacci number is a single problem and can be isolated. The specific part of the problem can use some 'black box' of a Fibonacci number generator.
The case is: the solution of the problem use some concepts and that concepts should be able to be isolated on a lib.

Of course, that is my opinion. I think the decision should be made on the project big picture.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants