This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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}!`)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ['A', 'B', 'C'].map(element => { | |
| let result; | |
| if (element === 'A') { | |
| result = 'a'; | |
| } | |
| if (element === 'B') { | |
| result = 'b'; | |
| } | |
| if (element === 'C') { | |
| result = 'c'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | |
| } |
NewerOlder