Continuations as collections

Continuations as collections

Creating a collection library for continuations

Creating a collection library for continuations

Last week I published an article on  continuations in TypeScript. In that article, I mentioned that continuations (unlike promises) act like collections of values that start existing over time. In this article I want to explore this further and see how much your traditional array has in common with continuations.

The big limiting factor when implementing a collection library for continuations is that we don’t know the values the continuation is going to output or even how many. As a result of this not all of the methods that are widely accepted to be standard collection operators can be implemented for continuations. However, the asynchronous nature of continuations also allows for new unique and interesting methods to be defined.

Quick recap

A continuation is an abstraction of something that produces values over time. In essence, it is nothing more than ‘a thing’ that you give a callback and it will call that callback whenever it some value. This means that a continuation is pretty similar to a promise, with the main exception being that a promise always only produces one value whereas a continuation can produce many values.

const keyboard = () => create_cont<Event>(cb => {
  document.addEventListener('keypress', cb)

programming javascript typescript

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Object-Oriented Programming with Javascript — using Typescript

Object-Oriented Programming With JavaScript — Using Typescript. TypeScript lets you write JavaScript the way you really want to. TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. TypeScript is pure Object-oriented with classes, interfaces, and statically typed like C# or Java.

What is TypeScript? Why TypeScript? and Why Not TypeScript?

TypeScript extends JavaScript by adding Types. There are many great reasons to switch to TypeScript. Especially if your team uses JavaScript. There are some reasons to not use TypeScript as there are with any language or framework.

TypeScript Tutorial For JavaScript Developers - TypeScript Basics

TypeScript Tutorial For JavaScript Developers - TypeScript Basics. I will show you guys 4 example of JavaScript code, and how to convert it to TypeScript. This is a typescript beginners tutorial.

TypeScript: A Superset of JavaScript

Multi-paradigm, Functional, Generic, Imperative, Object-Oriented. In this article, I have shared the essential information about TypeScript programming language. This article contains a basic overview, brief history, features and applications of TypeScript. TypeScript is getting more popular in Full-stack development. In terms of popularity, in the last two years TypeScript pulled ahead of Ruby, Shell, and C.

Object-oriented Programming in JavaScript: Made Super Simple. DO NOT MISS!!!

Object-oriented Programming in JavaScript: Made Super Simple. Learn all about objects, prototypes, prototypical inheritance, this and more.