One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
Please note we have a code of conduct, please follow it in all your interactions with the project.
/** | |
* JS Curried Pipe Function | |
* | |
* @param {array} arr input function chain | |
* @example | |
* let calculateCost = pipe([ | |
* products => products.reduce(plus), // Total Price | |
* price => price * 1.2, // Tax | |
* price => price - 50 // Discount | |
* ]); |
/** | |
* JS promisified setTimeout | |
* | |
* @param {number} ms timeout time in ms | |
* @example | |
* wait(2000).then(console.log) | |
* // => logs after 2 seconds | |
* @returns {Promise} A promise that resolves after the specified time `ms` | |
*/ | |
let wait = ms => new Promise(res => setTimeout(res, ms)); |
/** | |
* Takes a function and curries it | |
* @param {function} func input non-curried function | |
* @param {number} [amountArgs=func.length] number of arguments to collect; defaults to func.length | |
* @example | |
* let plus = (a, b) => a+b; | |
* let curriedPlus = curry(plus); | |
* curriedPlus(1)(2) | |
* // => 3 | |
* @returns a collect function for collecting the arguments and calling the input function |
/** | |
* Generate the fibonaccie sequence recursively | |
* @param {number} num amount of recursion | |
* @returns {array} fibonacci sequence | |
*/ | |
let fib = num => { | |
if (num == 1) return [1]; | |
else { | |
let prev = fib(num - 1); | |
return prev.concat((prev[prev.length - 2] || 0) + prev[prev.length - 1]) |
// Adapted from https://stackoverflow.com/questions/34848505/how-to-make-a-loading-animation-in-console-application-written-in-javascript-or | |
/** | |
* Create and display a loader in the console. | |
* | |
* @param {string} [text=""] Text to display after loader | |
* @param {array.<string>} [chars=["⠙", "⠘", "⠰", "⠴", "⠤", "⠦", "⠆", "⠃", "⠋", "⠉"]] | |
* Array of characters representing loader steps | |
* @param {number} [delay=100] Delay in ms between loader steps | |
* @example |
pub struct Fib { | |
a: u32, | |
b: u32, | |
count: i32, | |
} | |
impl Fib { | |
pub fn new(count: i32) -> Fib { | |
Fib { a: 1, b: 1, count } | |
} |
fn main() { | |
for x in 1..101 { | |
let mut out = String::new(); | |
if x % 3 == 0 { | |
out += "fizz"; | |
} | |
if x % 5 == 0 { | |
out += "buzz"; |