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

Base Library usage #433

Open
idkjs opened this issue Nov 9, 2021 · 5 comments
Open

Base Library usage #433

idkjs opened this issue Nov 9, 2021 · 5 comments

Comments

@idkjs
Copy link

idkjs commented Nov 9, 2021

Hey folks,

First thanks for this excellent project and congratulations on the new v3. It is certainly much cleaner looking with more detailed instructions. Should be easier for people to get into though it wasnt that hard to begin with.

I have come back to this after a while and am only now noticing the use of Janestreet's Base library. Might have been there before.

Even though I have been starring at code in the ocaml ecosystem for a while, I have never really used base.

I wanted to suggest maybe make some projects that teach/demonstrate using Base that would target the type of beginner user you can expect.

For example, unwinding a result of a function out of Base.Result.t is really undoable if you dont have a clue.

Maybe we can add some language to the Readme's with examples about what that is or looks like.

I am not sure if this is an issue or suggestion that would be better presented somewhere else. Let me know.

Peace/Love and thank you, again.

@tautologico
Copy link
Contributor

I think all exercises should be solvable without Base, as many people in the community prefer not to use it. There are some exercises where this is currently impossible, but they could be fixed.

@nrolland
Copy link
Contributor

nrolland commented Aug 9, 2023

the make test_generatorstep still refers to base and a few other library. It would be worthwhile to either take them out of the tests, or add them to the dependencies list of make install_deps

@georgyo
Copy link
Member

georgyo commented Aug 13, 2023

Unless anyone objects strongly, I am going to close this issue in a week.

I agree that all the problems should be solvable without base, and I think issues about those specific problems could be tickets. But as it stands now I don't think I've come across one that wasn't solvable without using base.

In ocaml a type can be made to the same as other types, and base does a pretty good job of this. IE Base.Result.t and Result.t are interchangeable. Even if the tests and mli are using Base.Result.t the implementation can still not use Base at all.

@nrolland I don't think anyone noticed the missing dependencies in make install_deps because the both the test runner and this github action to test this repo don't use that function. Those docker files call opam install directly. IE:

ocaml/.github/Dockerfile

Lines 14 to 15 in a0afba8

RUN opam update \
&& opam install core \

I'll create a PR to fix that up.

@Lattay
Copy link
Contributor

Lattay commented Nov 4, 2023

The exercise count_nucleotide uses a Base.Map as it output type, which makes it impossible to solve the exercise without Base.
Unfortunately, the fact that Base is opened by default causes confusion (in particular with =).
Also Base.Map appears to be very confusing to students, as I have seen while mentoring.
I have seen several students trying to do crazy applicative functor stuff when they are way to early in their learning process, just because the doc of Base.Map is confusing.
I think at least that exercise should be reworked to use something more generic as an output, maybe simply a function.

@nkhlmn
Copy link

nkhlmn commented Jan 12, 2024

I am new to OCaml and had the exact experience described by @Lattay . I actually abandoned exercism as a learning resource after being confused by count_nucleotide and started using AoC for practice. Now that I am over the hump (pun very much intended), it makes sense to me why I was confused and I have more context about Core, Base and whatnot.

I'm really liking OCaml but I think my biggest complaint (asides from lack of easy pretty printing; though utop makes up for that) is the split between using the standard library vs Jane Streets'. I think it would be a dramatically better experience for people learning to avoid this issue at the beginning.

I'd be happy to submit a PR for count_nucleotide and any others I come across if they would be accepted. Even using a Map is maybe not necessary for an early exercise when an associatian list would also do the trick (and IMO better to learn first).

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

6 participants