Skip to content

takkyu2/purely-functional-data-structures

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Purely Functional Data Structures in C++

Yet another implementation of the immutable data structures in Okasaki's textbook, "Purely Functional Data Structures", in C++.

Requirements

A C++20 compatible compiler is necessary. For instance, g++ 10.2.0 with -std=c++20 flag compiles the codes successfully.

Disclaimers

  • The code is at a very early stage. There should be bugs and rough edges.

  • In Chapter 10 and 11, we need a polymorphic recursion. Although the static typing system of C++ forbids a proliferation of infinite number of types at compile time (i.e., a genuine polymorphic recursion), we can introduce the auxiliary cutoff for the number of the recursions with constexpr-if; If the depth of the recursion exceeds this cutoff number, the runtime exception is thrown. I will use this pseudo "polymorphic recursion".

List of data structures

Chapter 2

Chapter 3

Chapter 4

Chapter 5

Chapter 6

Chapter 7

Chapter 8

Chapter 9

Chapter 10

Chapter 11

References

okasaki: Purely Functional Data Structures

type erasure: C++ Templates - The Complete Guide

lazy evaluation: Functional Programming in C++

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages