Skip to content

Latest commit

 

History

History
24 lines (15 loc) · 783 Bytes

README.md

File metadata and controls

24 lines (15 loc) · 783 Bytes

Interner

Fast general-purpose interners for every use case

Interners take complex values and map them to trivially-comparable stand-ins that can later be resolved back to their source values. Interners are often found in software like parsers, language interpreters, and compilers; they can be used whenever a given algorithm compares its inputs by identity only.

Examples

import Interner

let interner = Interner<String>()

let string = "Hello"
let symbol = interner.interned(string)
let resolved = interner.lookup(symbol)

XCTAssert(resolved == string)

License

This project is licensed under the MPL-2.0 – see the LICENSE.md file for details.