GithubHelp home page GithubHelp logo

protoship / learn-reasonml-workshop Goto Github PK

View Code? Open in Web Editor NEW
271.0 6.0 45.0 163 KB

Learn ReasonML with 24 exercises. No prior functional programming knowledge required.

License: Apache License 2.0

C++ 1.47% Reason 98.53%
reasonml ocaml

learn-reasonml-workshop's People

Contributors

0xflotus avatar ajaleelp avatar arbaaz avatar danieledelgiudice avatar harigopal avatar jasim avatar jcsherin avatar kiranps avatar tejasbubane avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

learn-reasonml-workshop's Issues

Ex. 09 - unclear solution

I'm a bit confused about the intended solution for exercise 09:

/*
  Write a function to construct a list of all integers in the range [from,to_]
  in increasing order.

  let range: (int, int) => list(int)
 */
let range = (from, to_) => failwith("For you to implement");

Since this lesson is about the infix append operator @, I would think that it's supposed to be used here. Also, the function isn't declared as rec in the template, which makes me believe that we are expected to solve it with a non-recursive function.

However, with my current knowledge of reason I don't know how to do this without recursion. (I'm sure it is possible somehow, I just don't think that the skillset of ex. 1-9 allows it). And I can't think of a solution where @ would be better than the rest operator. The only solution I can come up with is this or its variations:

let rec range = (from, to_) => if(from < to_) {
  [from, ...range(from + 1, to_)]
else {
  []
};

However that solution doesn't fit into the learning flow at all IMO since it doesn't use anything new, especially not the new @ operator that this exercise is supposed to be about (yes you could [from] @ range(...) but that's not a proper use of append IMO). Also it is recursive without being declared as such in the template, which doesn't match with any previous or upcoming exercises where a function is always declared as recursive if expected to be solved that way.

Could you clarify whether my solution is the intended one? If so I would suggest adding the rec declaration to the template, in order to make it a bit more apparent that it is supposed to be solved with recursion too.

Is the syntax still valid?

Now that reason is changing fast, I was wondering if I could still go through this tutorial without syntax problems?

Ex. 15 refers to OCaml syntax

Ex. 15 contains comments:

The signature for a tuple is written by separating all the types within the tuple by a *.

Solutions of these exercises

Hi,

I am wondering if there are solutions for these exercises in a different repo that i can check with my own answers?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.