lazy-arr - Arrays that look just like regular JavaScript arrays, but are computed lazily.

  •        3

Arrays that look just like regular JavaScript arrays, but are computed lazily. Like Scala or Haskell's lazy streams. Read more about it in the introductory blog post: https://performancejs.com/post/ewffd34/Introducing:-Lazy-arrays-in-JavaScript. Lazy-arr takes a function, and uses it to lazily generate values for the array. The function takes a numerical array index (eg. 5) and should return the value for that index in the array. The function doesn't have to be idempotent, but its return value will be cached (you can then delete it from cache, if you want).

https://github.com/bcherny/lazy-arr#readme
https://github.com/bcherny/lazy-arr

Tags
Implementation
License
Platform

   




Related Projects

streamjs - Lazy Object Streaming Pipeline for JavaScript

  •    Javascript

Stream.js is a lightweight (2.6 KB minified, gzipped), intensely tested (700+ assertions, 97% coverage) functional programming library for operating upon collections of in-memory data. It requires EcmaScript 5+, has built-in support for ES6 features and works in all current browsers, Node.js and Java 8 Nashorn. Before explaining how Stream.js works in detail, here's a few real world code samples.

Eta - A powerful language for building scalable systems on the JVM

  •    Haskell

Eta is a pure, lazy, strongly typed functional programming language on the JVM. It is a dialect of Haskell on the JVM. It is pure by default which means that calling a function with the same arguments will yield the same results every time. It is lazy by default which means that data stays in unevaluated state until a function needs to peek inside.

Knapsack - Collection pipeline library for PHP

  •    PHP

Knapsack is a collection library for PHP >= 5.6 that implements most of the sequence operations proposed by Clojures sequences plus some additional ones. All its features are available as functions (for functional programming) and as a collection pipeline object methods. The heart of Knapsack is its Collection class. However its every method calls a simple function with the same name that does the actual heavy lifting. These are located in DusanKasan\Knapsack namespace and you can find them here. Collection is a Traversable implementor (via IteratorAggregate) that accepts Traversable object, array or even a callable that produces a Traversable object or array as constructor argument. It provides most of Clojures sequence functionality plus some extra features. It is also immutable - operations preformed on the collection will return new collection (or value) instead of modifying the original collection.


yall.js - A fast, flexible, and small image lazy loader!

  •    Javascript

yall.js is a featured-packed lazy loading script for <img>, <picture>, <video> and <iframe> elements. It works in all modern browsers including IE11. It uses Intersection Observer where available, but falls back to scroll, touchmove, resize, and orientationchange events where necessary. It can also monitor the DOM for changes using Mutation Observer to lazy load image elements that have been appended to the DOM after initial page render, which may be desirable for single page applications. It can also (optionally) optimize use of browser idle time using requestIdleCallback. To optimize decoding of <img> lazy loading for simple src and srcset use cases, yall.js uses Image.decode where available to decode images asynchronously before adding them to the DOM.

immu - A TINY, fail-fast, lazy, immutable Javascript objects library.

  •    Javascript

A TINY, fail-fast, lazy, "naked", simple immutable Javascript objects library. Immu does not attempt to add functionality to Arrays, introduce complex data structures like Map and Set, or provide a complete solution with cursors and stores. Immu is meant to be the simplest possible solution to providing immutable objects while maintaining the native API for those objects (including Array methods).

xtensor - C++ tensors with broadcasting and lazy computing

  •    C++

Multi-dimensional arrays with broadcasting and lazy computing. xtensor is a C++ library meant for numerical analysis with multi-dimensional array expressions.

Streams - Lazy evaluation in C++ - http://jscheiny.github.io/Streams/

  •    C++

Streams is a C++ library that provides lazy evaluation and functional-style transformations on the data, to ease the use of C++ standard library containers and algorithms. Streams support many common functional operations such as map, filter, and reduce, as well as various other useful operations such as various set operations (union, intersection, difference), partial sum, and adjacent difference, as well as many others. To use, simply #include "Stream.h", and compile using a C++14 compatible compiler. All streams classes/functions can be found in the stream namespace.

lozad

  •    Javascript

It is written with an aim to lazy load images, iframes, ads, videos or any other element using the recently added Intersection Observer API with tremendous performance benefits. Existing lazy loading libraries hook up to the scroll event or use a periodic timer and call getBoundingClientRect() on elements that need to be lazy loaded. This approach, however, is painfully slow as each call to getBoundingClientRect() forces the browser to re-layout the entire page and will introduce considerable jank to your website.

LazyCache - An easy to use thread safe generics based in memory caching service with a simple developer friendly API for c#

  •    CSharp

Lazy cache is a simple in-memory caching service. It has a developer friendly generics based API, and provides a thread safe cache implementation that guarantees to only execute your cachable delegates once (it's lazy!). Under the hood it leverages Microsoft.Extensions.Caching and Lazy to provide performance and reliability in heavy load scenarios. As you can see the magic happens in the GetOrAdd() method which gives the consumer an atomic and tidy way to add caching to your code. It leverages a factory delegate Func and generics to make it easy to add cached method calls to your app.

ng-lazyload-image - Lazy image loader for Angular ≥ v2

  •    TypeScript

The browser you targeting need to have support of WeakMap and String.prototype.includes. If you need to support an older browser (like IE) you will need to include polyfill for WeakMap and String.prototype.includes (see https://github.com/zloirock/core-js for example).

blazy - Hey, be lazy! bLazy

  •    Javascript

bLazy is a lightweight script for lazy loading and multi-serving images, iframes, videos and more (less than 1.4KB minified and gzipped). It’s written in pure JavaScript why it doesn’t depend on 3rd-party libraries such as jQuery. It lets you lazy load and multi-serve your images so you can save bandwidth and server requests. The user will have faster load times and save data usage if he/she doesn't browse the whole page. If you don't want to host the script yourself you can link to the latest minified file: //cdn.jsdelivr.net/blazy/latest/blazy.min.js on jsDelivr. Exchange latest with the specific version number if you want to lock it in.

filed - Simplified file library.

  •    Javascript

Filed does a lazy stat call so you can actually open a file and begin writing to it and if the file isn't there it will just be created. The returned file object is a stream so you can do standard stream stuff to it. Based on what you do the object it will be a read stream, a write stream.

MonadEx - Upgrade your pipelines with monads.

  •    Elixir

MonadEx introduces monads into Elixir. Monads encapsulate state and control the flow of code. A monad's bind operation is similar, but more powerful, than Elixir's built-in pipelines. Monads may be combined to make even more useful constructs. For example, you may want to use a state monad in combination with a result monad. The state monad can track a shared environment and the result monad can keep track of the success or failure state.

node-thunkify - Turn a regular node function into one which returns a thunk

  •    Javascript

Turn a regular node function into one which returns a thunk, useful for generator-based flow control such as co.

node-lazy - lazy lists for node.js

  •    Javascript

lazy lists for node.js

echo - Lazy-loading images with data-* attributes

  •    Javascript

Echo is a standalone JavaScript lazy-loading image micro-library. Echo is fast, 2KB, and uses HTML5 data-* attributes for simple. Check out a demo. Echo works in IE8+.Using Echo.js is simple, to add an image directly into the page simply add a data-echo attribute to the img tag. Alternatively if you want to use Echo to lazy load background images simply add a `data-echo-background' attribute to the element with the image URL.

Lazy mans backup

  •    

A backup system for lazy people! Lmbk maintains a database of files due for backup or archiving. The lazy user runs lmbk regularly to save changed files on backup media. Media is tracked for reuse or replacement based on its age and type.