Skip to content

Instantly share code, notes, and snippets.

@a-beco
a-beco / LevenshteinDistance.swift
Created May 3, 2017 18:06
Calculate Levenshtein distance in swift.
//
// LevenshteinDistance
//
// Created by Kohei Abe on 2017/05/04.
// Copyright © 2017年 Kohei Abe. All rights reserved.
//
import Foundation
func levenshteinDistance(_ word1: String, _ word2: String) -> Int {
@a-beco
a-beco / ReverseList.swift
Last active May 3, 2017 18:05
Reverse a list in swift.
//
// ReverseList
//
// Created by Kohei Abe on 2017/05/04.
// Copyright © 2017年 Kohei Abe. All rights reserved.
//
import Foundation
/// List Element holding 1 character
@a-beco
a-beco / Memoise.swift
Last active May 4, 2017 08:56
Customizable memoise function in Swift.
//
// Memoise
//
// Created by Kohei Abe on 2017/04/20.
// Copyright © 2017年 Kohei Abe. All rights reserved.
//
import Foundation
struct CacheData<In, Out> {