protoship / learn-reasonml-workshop Goto Github PK
View Code? Open in Web Editor NEWLearn ReasonML with 24 exercises. No prior functional programming knowledge required.
License: Apache License 2.0
Learn ReasonML with 24 exercises. No prior functional programming knowledge required.
License: Apache License 2.0
Guess prelude.re
and prelude.bs.js
in /20-reading_sigs
are junk files?
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.
Now that reason is changing fast, I was wondering if I could still go through this tutorial without syntax problems?
Ex. 15 contains comments:
The signature for a tuple is written by separating all the types within the tuple by a *.
learn-reasonml-workshop/src/exercises/05-twice/twice.re
Lines 19 to 23 in f3f320e
Definition of twice
takes 2 arguments but usage in add2
takes only 1. This might be confusing for people unaware about the implicit currying.
When running npm install I get the following:
`learn-reasonml-workshop\node_modules\bs-platform\lib\ocaml\block.cmj
fs.js:143
throw new ERR_INVALID_CALLBACK();
^
TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
at makeCallback (fs.js:143:11)
at Object.rename (fs.js:596:14)`
Hi,
I am wondering if there are solutions for these exercises in a different repo that i can check with my own answers?
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.