Skip to content

jonahgoldwastaken/functional-programming

Repository files navigation

Functional Programming

WikiConceptPracticing with survey dataProcessing RDW Data

This repo is created to process data provided by de Volkskrant, so that a data visualisation can be created using D3. The data consists of parking data gathered by the RDW (Dutch Vehicle Authority), and contains many different variables that can be put together, combined, made relationships with. This should create an interesting data-visualisation, which de Volkskrant can use to write an article. Read more about this in my Debriefing.

Learning goals

  • Understanding and applying Functional Programming principles:
    • Pure and Impure functions
    • Higher-order functions
    • Composition
    • Currying
    • Immutability
  • Data processing techniques

Getting started

Setting up the repo

To get started, you first need to clone the repo and install the dependencies:

git clone https://github.com/theonejonahgold/functional-programming
cd functional-programming
yarn install || yarn

Available commands

yarn watch # Watches the src & dist folder on file changes
yarn build # Builds the TypeScript code in the src folder
yarn start # Starts Node in the dist folder
yarn lint  # Runs ESLint on files to check for consistent code.

Concept

Extended version

Main Question

What is the relation between distance and availability of parking places to hot-spots in the city?

Research questions

  • Where are the parking places situated?
  • How many parking garages are open 24 hours a day?
  • What is the average closing time for parking garages?
  • Do parking garages change their prices during the night, and how?
  • With how many parking garages can you exit with your vehicle throughout the entire day?
  • What is the capacity of the parking places?

Used variables

The used variables are available through this link.

Project structure

.
├── src    # Contains JS and CSS source code.
│   ├── data        # Here, all the data files are put. For privacy reasons, this folder only contains a .gitkeep file on the public repository. You need to supply your own data.
│   ├── utilities   # Utilities are general functions that can be adapted to certain use cases. They are divided into files named after the type they manipulate.
│   ├── helpers     # This folder is for functions used for specific use cases like language parsing.
│   ├── modules     # The modules folder is a place where all functions compositions are written.
│   ├── index.js    # Where it all comes together. This file is run when compiled to JS code.
│   └── index.css   # The main CSS file, where all the styling is created using TailwindCSS.
├── public
│   └── index.html  # The html file that gets loaded when you run a dev server or run start a production build.
├── build  # Contains identical folder structure as src folder, with compiled JS code, node modules compiled to web modules.
└── config # Contains the Nodemon configurations used for development of this project.

Functional Programming Principles Applied

  • Composition: The combining of functions to create extra functionality.
  • Functional purity: All functions give the same output when the same input is used.
  • Data immutability: All data passed into the functions is copied and then mutated, so that the original data itself is never mutated.
  • Currying: All functions return a function that can be used in a Higher-order function.
  • Higher order functions: All functions created can be passed into these to manipulate the data passed.

Tools used

About

A repo dedicated to learning functional programming principle by applying them to a research case

Topics

Resources

Stars

Watchers

Forks

Languages