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

v0 state

Back to all declarations

realmPath

untyped string

Value

"gno.land/r/moul/x/allinone/textlab/v0"

maxInput

untyped bigint

maxInput bounds what a render path can carry into the algorithms below. levenshtein.Matrix is O(len(a) \* len(b)), so an unbounded pair of inputs is a way to make a query expensive for whoever serves it.

Value

(64 <untyped> bigint)

defaultWord

untyped string

defaultWord is what the root view demonstrates, chosen because it is the textbook case where the two similarity measures disagree: "knight" and "night" sound identical to soundex and are one edit apart.

Value

"knight"

Render

func(path string) string

Render takes its input from the path: one word, or two separated by "/".

Open
OID
03189e…deca:3
Render details

Inspect func

renderOne

func(word string) string

renderOne is every single-input algorithm, one row each. ui.Cell, not ui.Inline: these land in table cells, where an unescaped pipe would silently eat a column. The input is whatever someone put in a URL.

Open
OID
03189e…deca:6
renderOne details

Inspect func

romanOf

func(word string) string

romanOf shows the round trip both ways, because romannum is the one package here whose input is a number rather than a word. FromRoman PANICS on anything that is not a roman numeral rather than returning zero, and the input here comes out of a URL, so it is screened first. Without that screen the DEFAULT view aborts: "knight" is not a roman numeral, and neither is most of what anyone would type.

Open
OID
03189e…deca:7
romanOf details

Inspect func

isRomanNumeral

func(s string) bool

isRomanNumeral reports whether every byte is a roman digit. It is a screen for romanOf, not a validity check: "IIII" passes here and FromRoman decides.

Open
OID
03189e…deca:8
isRomanNumeral details

Inspect func

renderPair

func(a string, b string) string

renderPair is the comparison, and the reason this realm exists: the two similarity measures answer different questions, and a reader should watch them disagree rather than be told they might.

Open
OID
03189e…deca:9
renderPair details

Inspect func
realmPath : untyped string ="gno.land/r/moul/x/allinone/textlab/v0"
maxInput : untyped bigint =(64 <untyped> bigint)
defaultWord : untyped string ="knight"
Render : func(path string) string Inspect
tooLong : func(s string) bool Inspect
renderOne : func(word string) string Inspect
romanOf : func(word string) string Inspect
isRomanNumeral : func(s string) bool Inspect
renderPair : func(a string, b string) string Inspect
yesNo : func(b bool) string Inspect
renderTry : func() string Inspect