Skip to content

Instantly share code, notes, and snippets.

View AndrewBestbier's full-sized avatar

Andrew AndrewBestbier

  • McKinsey & Company
  • London
View GitHub Profile
@AndrewBestbier
AndrewBestbier / index.js
Created August 22, 2019 21:13
index.js
const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => res.send('Hello World!'))
app.listen(port, () => console.log(`Example app listening on port ${port}!`))
['A', 'B', 'C'].map(element => {
let result;
if (element === 'A') {
result = 'a';
}
if (element === 'B') {
result = 'b';
}
if (element === 'C') {
result = 'c';
import Prelude
import Data.Complex
data CompassPoint = E | N | W | S deriving (Show, Enum)
type Position = Complex Double
type Point = (Position, CompassPoint, Int)
type ComplexPoint = (Point, [Point])
-- Question 1
question1 n = (\((x:+y), _) -> abs x + abs y) . last . take n $ iterate step1 ((0:+0), E)
const values = [1, 2, 3, 'a', 'b', 'c'];
// [] -> []
// [x] -> [x]
// x: xs : y -> [x, y] ++ func(xs)
const melder = values => {
if (values.length <= 1) {
return values;
}