Skip to content

Instantly share code, notes, and snippets.

View OlivierBinette's full-sized avatar
🧑‍💻

Olivier Binette OlivierBinette

🧑‍💻
View GitHub Profile
@OlivierBinette
OlivierBinette / assert.R
Last active September 29, 2021 00:34
[Assert] Validate function arguments #R
assert <- function(..., msg=NULL) {
# Assert that each of the provided expression is true. Otherwise returns a
# description of each failed assertion.
#
# Args:
# ...: List of logical assertions
# msg: Optional parameter printed when one of the assertions fails.
#
# Returns:
# Nothing if all assertions pass. Otherwise throws an error describing which
@bicycle1885
bicycle1885 / approx_search.jl
Created March 30, 2016 20:04
Myers' Approximate String Search Algorithm
# Approximate String Search
# =========================
#
# Myers, Gene. "A fast bit-vector algorithm for approximate string matching
# based on dynamic programming." Journal of the ACM (JACM) 46.3 (1999): 395-415.
#
"""
approx_search(text, query, k)