Skip to content Search Apps Documentation Source Content Run Reset Eval Playground 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 state

Back to all declarations

worked

untyped string

worked is the example small enough to check by hand: 11 bytes, 5 symbols, frequencies 5/2/2/1/1.

Value

"abracadabra"

samples

[]string (len=4)

samples show what the skew is worth. The first is flat by construction, the last is almost all one symbol, and the ratio moves the whole way between.

Open
OID
017aeb…9cf1:4
samples details (len=4)

+4 more Inspect slice

Render

func(path string) string

Render renders the demo for gnoweb. Render("") / Render("/") -> the worked example, the ratios, the edge cases Render("/<text>") -> encode that text and show its table

Open
OID
017aeb…9cf1:5
Render details

Inspect func

renderInput

func(in string) string

renderInput encodes a caller's text. Everything echoed back goes through md.InlineCode or ui.Inline: the string arrives from the URL and is attacker controlled markdown until it is escaped. A hand-built code span would not do, because an escaped backtick still closes the span.

Open
OID
017aeb…9cf1:7
renderInput details

Inspect func

ratioLine

func(e *v0.Encoded) string

ratioLine states the budget in one sentence.

Open
OID
017aeb…9cf1:8
ratioLine details

Inspect func

percent

func(e *v0.Encoded) int

percent is the saving as a whole number. Integer arithmetic: a Render that prints a float is a Render that prints a different float on another node.

Open
OID
017aeb…9cf1:9
percent details

Inspect func

symbolLabel

func(b uint8) string

symbolLabel renders one byte for a table cell. A symbol is a BYTE, not a rune: converting a byte above 127 with string(b) produces a two-byte UTF-8 sequence that is not the byte the code stands for, which would make the count beside it wrong for any non-ASCII input. Anything outside printable ASCII is shown as hex instead.

Open
OID
017aeb…9cf1:10
symbolLabel details

Inspect func

countByte

func(s string, b uint8) int

countByte counts one byte in s, for the same reason symbolLabel exists.

Open
OID
017aeb…9cf1:11
countByte details

Inspect func

parseArg

func(path string) string
Open
OID
017aeb…9cf1:12
parseArg details

Inspect func
worked : untyped string ="abracadabra"
samples : []string (len=4) Inspect
Render : func(path string) string Inspect
renderInput : func(in string) string Inspect
ratioLine : func(e *v0.Encoded) string Inspect
percent : func(e *v0.Encoded) int Inspect
symbolLabel : func(b uint8) string Inspect
countByte : func(s string, b uint8) int Inspect
parseArg : func(path string) string Inspect