Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

v0 source realm

Package ahocorasickdemo is a small gnoweb demo of the [p/moul/x/daily/ahocorasick](/p/moul/x/daily/ahocorasick)(/p/mo...

Readme View source

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

A gnoweb demo of p/moul/x/daily/ahocorasick: two scans, no state, no search logic of its own.

/r/moul/x/daily/ahocorasickdemo/v0           the textbook automaton and the sentence scan
/r/moul/x/daily/ahocorasickdemo/v0:/thermos  scan your own text with the same dictionary

The first table is the 1975 paper's own example, he / she / his / hers over ushers, which is the smallest input where the interesting thing happens: three of the four patterns overlap and one of them is only found through a failure link. The second runs a five word dictionary over a sentence and prints the count that is the whole claim, the bytes were read once and running a single-pattern scan per word would have read them five times.

Fixed inputs, never chain state, deliberately. Every value rendered here is a package level variable. Output that moved with the block height could not be pinned by ExampleRender, and an unpinned Render is how a realm ships a page nobody ever read.

The match table never echoes a slice of the scanned text. It reports offsets and the pattern that matched, and the patterns are this realm's own constants. So the visitor's text reaches the page exactly once, in the heading that echoes it, where it goes through md.InlineCode and not ui.Cell: it sits inside a code span, a cell escaper backslashes a backtick, and a backslash does not close a backtick inside a span. Only a fence wider than anything in the argument does, which is what md.InlineCode picks. A realm's Render can never be fixed once the path is live.

parseArg takes the one routing slash off and nothing else: it does not cut at a later slash and it does not trim. A page that offers to scan what the caller typed either scans that string or says it found nothing, and never quietly substitutes a shorter or tidier one, which would report offsets into a string nobody submitted.

Built for gno 0.9.


Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.

On mainnet: deployment status transactions unique callers deployed revision

Dependency graph:

gno.land/r/moul/x/daily/ahocorasickdemo/v0 dependency graph

🧪 Highly experimental — potentially vibe-coded. Not audited; may break, change, or be removed at any time. Do not use with anything of value. Full disclaimer: DISCLAIMER.

Overview

Package ahocorasickdemo is a small gnoweb demo of the p/moul/x/daily/ahocorasick(/p/moul/x/daily/ahocorasick/v0) library: it runs one automaton over a text once and shows the overlapping matches a k-pass scan would have to pay k passes for.

It contains no search logic of its own. Stateless, so Render is deterministic.

Functions 1

func Render

1func Render(path string) string
source

Render renders the demo for gnoweb.

Example
1Render("") / Render("/")  -> the textbook automaton and the sentence scan
2Render("/<text>")         -> scan that text with the same dictionary

Dependencies

Source Files 5