Skip to content

Instantly share code, notes, and snippets.

View wdiasvargas's full-sized avatar

William Dias wdiasvargas

View GitHub Profile
@lubien
lubien / imap-islice.js
Created June 24, 2017 18:08
Proof of concept of lazy evaluation of map and slices on JavaScript using generators, iterables and iterators. https://repl.it/JAbL/1
/*
* imap lazily maps an interable.
* @param ref Either an iterable or an iterator
* @param fn Map function
*
* It works by always returning a new iterator so that
* you can chain other imaps without looping once more
* over the same array!
*
* Since iterators are returned, to start the real mapping
@lubien
lubien / imap.js
Last active June 23, 2017 19:56
Proof of concept that you can map multiple functions with only one iteration in JavaScript using iterators (like in Python). Run https://repl.it/Izou/2
/*
* imap lazily maps an interable.
* @param fn Map function
* @param iterableOrIterator Either an iterable or an iterator
*
* It works by always returning a new iterator so that
* you can chain other imaps without loopin once more
* over the same array!
*
* Since iterables are returned, to start the real mapping
@mrosata
mrosata / la-ramda.js
Last active January 15, 2023 01:47
A subset of the Ramda library written using arrow functions, "lamda-ramda". The purpose of this is fun and to use in environments where importing 3rd party libs isn't allowed. Feel free to add to this.
const R = new LaRamda()
/**
* A subset of custom implementations of functions from
* the Ramda library. (all in Lamda form)
* - thanks to @xgrommx for uniq, intersection, where, evolve,
* applySpec, defaultTo, both, either, cond, zipWith
*/
function LaRamda () {
const I = x => x