Learning to solve exercises in general

I wondering how I am supposed to solve the exercises do I just read the documentation for example in OCaml I would read
Basic Data Types and Pattern Matching · OCaml Documentation and OCaml library or the textbook, OCaml Programming: Correct + Efficient + Beautiful — OCaml Programming: Correct + Efficient + Beautiful
and figure out what to use?

There are some tracks where volunteers have build out a learning path. For the others though, you’re on your own to decide what you need to do to learn. Did you peruse the track docs?

https://exercism.org/docs/tracks/python/problem-solving might help

Yes that helps, I also have been using Jiki to get better at problem solving which is easier because it tells you the functions to use and a concept library in the questions over there

1 Like

As noted, not every language has the “learning” track. What I’d recommend in these cases, and what I usually do anyway, is:

  • If you already know a language with the same overall paradigm, then continue. For OCaml this would be annother functional language like Lisp or derivatives. Otherwise you might want to start with another language of the same paradigm with better instruction available unless the new language already has pretty good resources. (OCaml seems ok as a start.)

  • Most languages have some sort of brief “intro”

  • There is also learnxinyminutes which has a very brief example of syntax for common features for many languages Learn OCaml in Y Minutes

  • There may sometimes also be a longer more detailed guide like the one you linked to

  • there’s usually a dry and detailed reference manual from which the previous is derived OCaml - The OCaml Manual and this is useful for looking up anything too specific or obscure for the previous

  • There is usually a “standard library” of some sort consisting of builtins and modules included with the standard base package

The last two are especially important for looking up a specific feature or function that you suspect already exists but that you haven’t encountered in tutorial material.

What I’ve noticed is that the exercises marked “easy” typically tell you almost exactly how to solve them so the main challenge is just locating the necessary syntax for expressing the solution using the above.

There are almost always multiple solutions that will test as being correct and there isn’t usually going to be an optimal one because the exercises don’t usually seem to specify if you’re supposed to optimize for time, space (memory use), code size, or easiest readability of the code.

Aside from that it’s the usual “4 steps for problem solving” etc.

2 Likes