Skip to content

Instantly share code, notes, and snippets.

View kutyel's full-sized avatar
🌊
数学者に俺は成る!

Flavio Corpa kutyel

🌊
数学者に俺は成る!
View GitHub Profile
@kutyel
kutyel / plain_concepts.js
Last active September 7, 2017 13:14
Solutions for the Plain Concepts JavaScript Quizz! ⚡
// ej1
const list = [1,2,3,4,5,6,7]
const result = list
.forEach(a => a % 2 === 0 ? a : -a)
.filter(b => b > 2)
.some(c => c < 10)
console.log('ej1', result) // throws an error, because of `forEach`
// ej2
const key = Symbol("${window}")
@kutyel
kutyel / comments.json
Created October 24, 2017 08:22
Comments to be fetched on the last day of my React Workshop 🐈⚛️
{
"1542302281977808155_3448238252": [
{
"from": {
"full_name": "rosaparksragdoll"
},
"text": "Hello Lovely 🐈🐾"
}
],
"1541532966311636230_3448238252": [
@kutyel
kutyel / fp.exercises_1.js
Last active October 31, 2017 11:15
Professor Frisby's functional programming exercises (Part 1: currying)
const expect = require('expect')
const { curry, split, map, filter, reduce } = require('ramda')
// Exercise 1
//==============
// Refactor to remove all arguments by partially applying the function.
const words = split(' ')
expect(words('Jingle bells Batman smells')).toEqual([
@kutyel
kutyel / fp.js
Last active July 17, 2019 17:13
Flavio's functional programming test
/*
* Implement the following classic FP functions using
* _only_ Array.prototype.{reduce|reduceRight}(). 🤓
*/
const filter = f => xs => xs
const map = f => xs => xs
const every = f => xs => xs
@kutyel
kutyel / fp.exercises_2.js
Last active October 26, 2017 12:46
Professor Frisby's functional programming exercises (Part 2: compose)
const accounting = require('accounting')
const expect = require('expect')
const {
add,
compose,
concat,
filter,
flip,
head,
join,
@kutyel
kutyel / curry.js
Last active August 5, 2019 20:51
My own implementation of curry 🍛
// Ultimate version
const curry = (f, ...args) =>
f.length <= args.length
? f(...args)
: x => curry(f, ...args, x)
@kutyel
kutyel / fp.exercises_3.js
Created October 30, 2017 15:25
Professor Frisby's functional programming exercises (Part 3: functors)
require('./support')
const expect = require('expect')
const Task = require('data.task')
const {
add,
curry,
compose,
concat,
prop,
map,
@kutyel
kutyel / fp.exercises_4.js
Created October 31, 2017 10:47
Professor Frisby's functional programming exercises (Part 4: monads)
require('./support')
const path = require('path')
const expect = require('expect')
const Task = require('data.task')
const {
chain,
curry,
compose,
identity,
prop,
@kutyel
kutyel / fp.exercises_5.js
Created November 6, 2017 09:28
Professor Frisby's functional programming exercises (Part 5: applicative functors)
require('./support')
const expect = require('expect')
const Task = require('data.task')
const { add, curry, reduce } = require('ramda')
// TEST HELPERS
// =====================
const getPost = i =>
new Task((rej, res) =>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.