1 0
Sign in to rate

Ramda - Functional Library for JavaScript

0.06MB. 0 audio & 0 images. Updated 2019-03-25.

Description

Reflects: Ramda v0.26.1 Blog Post: https://simonwjackson.io/blog/ramda-anki-sudy-deck/ ----- ***From the Ramda website:*** ## Ramda A practical functional library for JavaScript programmers. Build Status npm module dependencies Gitter ## Why Ramda? There are already several excellent libraries with a functional flavor. Typically, they are meant to be general-purpose toolkits, suitable for working in multiple paradigms. Ramda has a more focused goal. We wanted a library designed specifically for a functional programming style, one that makes it easy to create functional pipelines, one that never mutates user data. ## What's Different? The primary distinguishing features of Ramda are: Ramda emphasizes a purer functional style. Immutability and side-effect free functions are at the heart of its design philosophy. This can help you get the job done with simple, elegant code. Ramda functions are automatically curried. This allows you to easily build up new functions from old ones simply by not supplying the final parameters. The parameters to Ramda functions are arranged to make it convenient for currying. The data to be operated on is generally supplied last. The last two points together make it very easy to build functions as sequences of simpler functions, each of which transforms the data and passes it along to the next. Ramda is designed to support this style of coding. ## Philosophy Using Ramda should feel much like just using JavaScript. It is practical, functional JavaScript. We're not introducing lambda expressions in strings, we're not borrowing consed lists, we're not porting over all of the Clojure functions. Our basic data structures are plain JavaScript objects, and our usual collections are JavaScript arrays. We also keep other native features of JavaScript, such as functions as objects with properties. Functional programming is in good part about immutable objects and side-effect free functions. While Ramda does not enforce this, it enables such style to be as frictionless as possible. We aim for an implementation both clean and elegant, but the API is king. We sacrifice a great deal of implementation elegance for even a slightly cleaner API. Last but not least, Ramda strives for performance. A reliable and quick implementation wins over any notions of functional purity.

Sample (from 255 notes)

Cards are customizable! When this deck is imported into the desktop program, cards will appear as the deck author has made them. If you'd like to customize what appears on the front and back of a card, you can do so by clicking the Edit button, and then clicking the Cards button.
Front invert
Back Same as R.invertObj, however this accounts for objects with duplicate values by putting the values into an array.
Detail
Code const raceResultsByFirstName = { first: 'alice', second: 'jake', third: 'alice',};R.invert(raceResultsByFirstName);//=> { 'alice': ['first', 'third'], 'jake':['second'] }
Keys
Tags
Front fromPairs
Back Creates a new object from a list key-value pairs. If a key appears in multiple pairs, the rightmost pair is included in the object.
Detail
Code R.fromPairs([['a', 1], ['b', 2], ['c', 3]]); //=> {a: 1, b: 2, c: 3}
Keys
Tags
Front anyPass
Back Takes a list of predicates and returns a predicate that returns true for a given list of arguments if at least one of the provided predicates is satisfied by those arguments.
Detail The function returned is a curried function whose arity matches that of the highest-arity predicate.
Code const isClub = R.propEq('suit', '♣');const isSpade = R.propEq('suit', '♠');const isBlackCard = R.anyPass([isClub, isSpade]);isBlackCard({rank: '10', suit: '♣'}); //=> trueisBlackCard({rank: 'Q', suit: '♠'}); //=> trueisBlackCard({rank: 'Q', suit: '♦'}); //=> false
Keys
Tags

After the file is downloaded, double-click on it to open it in the desktop program.

At this time, it is not possible to add shared decks directly to your AnkiWeb account - they need to be added from the desktop then synchronized to AnkiWeb.

Reviews

on 1552225670
Thank you for effort!
Comment from author
Of course!