Coder Social home page Coder Social logo

fp-101's Introduction

TypeScript/JavaScript functional 101

The aim of this repository is to help you get used to the functional programming style. It is a collection of exercises, with automatic tests that will check your solutions. It does not explain functional concepts. It is also introductory, so advanced topics won't be covered.

The exercises can be solved using TypeScript or JavaScript (but I strongly recommend you to use TypeScript).

You will find the exercises here.

Is this guide for me?

If you want to start with functional programming and you know at least a little bit of JavaScript or TypeScript, then yes!

Setup

Running the tests

You can run all the tests with npm t or run an utilitary tool (npm run learn or ./learn) to just run the tests for the exercise you are interested in (recommended option).

Following the rules

It is really important to follow "the rules" when solving the exercises. They are there to help you solve the problems in a "functional way".

Solving the exercises

You will find the exercises here.

You can find the exercise's tests into src/exercises directory. They are sorted in the same way than in the exercises page. To solve one exercise, you should create a file next to the test file with the same name, but without the .test part. The first exercise (id) is already solved as an example. In that file you should define the function that solves the problem and export it. If it's well done, the tests should pass for that exercise.

For some exercises, you can reuse the solutions you've already done. You can (and should) also use the functions from @utils.

Solving the exercises with JS

Even though I recommend to use TypeScript, you can solve the exercises using JavaScript. Just use the .js extension instead of the .ts one for your solutions. Also, remember to set the property you want to export to module.exports. For instance, the first exercise would be like this solved with JavaScript (into a src/exercises/01-id/id.js file):

const id = x => x;

module.exports = {
	id
};

@utils

There is a collection of utility funtions called "@utils". You can import them by doing (for example):

import { add } from `@utils`;

The functions there are all curried. You can find the source code of them at src/utils directory.

Solutions

The solutions to the exercises are uploaded to the solutions branch, you can take a peek to them if you wish (though I recommend you to try solving the problems by yourself first).

Contributing

All the contributions (issues reporting, PRs, difussion, etc.) will be welcome.

License

MIT License.

fp-101's People

Contributors

dggluz avatar

Watchers

 avatar

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.