PathrockNetwork Gno Explorer
HomeBlocksTransactionsRealmsPackagesValidatorsAnalytics

PathrockNetwork Gno Explorer — an independent explorer for Gno.land Mainnet (gnoland-1), operated by PathrockNetwork. Not an official Gno.land service.

gnowebarchive RPC

gno.land/r/moul/x/daily/levenshteindemo/v0

Realm
Open in gnoweb ↗

Overview

Kind
Realm (renderable)
Name
v0
Namespace
moul / x / daily / levenshteindemo
Files
3 (README)(gnomod.toml)
Exported functions
1
Module
gno.land/r/moul/x/daily/levenshteindemo/v0
gno
0.9

Files (3)

  • README.mdmarkdown
  • gnomod.tomltoml
  • levenshteindemo.gnogno

Select a file to view its exact on-chain source. Sorted README → gnomod → sources → tests.

Functions

  • Render(path string) string

Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.

Rendered

RenderedRawgnoweb ↗
# Levenshtein edit distance

Demo of the [`p/moul/x/daily/levenshtein`](/p/moul/x/daily/levenshtein/v0) library. The **Levenshtein distance** between two strings is the minimum number of single-character edits — *insertions*, *deletions*, or *substitutions* — needed to turn one string into the other. The library implements the classic dynamic-programming algorithm (à la Go's `agext/levenshtein`) fully rune-aware and on-chain.

## Try it

Append two words as `/<a>/<b>`:

- [`/kitten/sitting`](/r/moul/x/daily/levenshteindemo/v0:kitten/sitting) → distance **3**
- [`/flaw/lawn`](/r/moul/x/daily/levenshteindemo/v0:flaw/lawn) → distance **2**
- [`/sunday/saturday`](/r/moul/x/daily/levenshteindemo/v0:sunday/saturday) → distance **3**
- [`/gno/gnoland`](/r/moul/x/daily/levenshteindemo/v0:gno/gnoland) → distance **4**

## The classic example

`kitten` → `sitting` = **3**:

1. `kitten` → `sitten` (substitute *k* → *s*)
2. `sitten` → `sittin` (substitute *e* → *i*)
3. `sittin` → `sitting` (insert *g* at the end)

## API

- `Distance(a, b string) int` — the edit distance.
- `Matrix(a, b string) [][]int` — the full DP matrix.
- `Similarity(a, b string) int` — a 0..100 similarity percentage.

vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.