Skip to Content
Mastering JavaScript Functional Programming
book

Mastering JavaScript Functional Programming

by Federico Kereki
November 2017
Intermediate to advanced
386 pages
9h 22m
English
Packt Publishing
Content preview from Mastering JavaScript Functional Programming

Continuation passing style

If we have recursive calls stacked too high, we already know that our logic will fail. On the other hand, we know that tail calls should alleviate that problem... but don't, because of browser implementations! However, there's a way out for this. Let's first consider how we can transform recursive calls into tail calls, by using a well-known FP concept, continuations, and we'll leave the problem of solving TCO limitations for the next section. (We mentioned continuations in the Callbacks, promises, and continuations section of Chapter 3, Starting Out With Functions - A Core Concept, but we didn't go into detail at that point.)

In FP parlance, a continuation is something that represents the state of a process and ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering JavaScript Functional Programming - Second Edition

Mastering JavaScript Functional Programming - Second Edition

Federico Kereki

Publisher Resources

ISBN: 9781787287440Supplemental Content