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

piglatin package

Overview

Package piglatin ports the classic "Pig Latin" translator — a staple Go beginner exercise — to an on-chain gno.land realm.

Rules implemented (the standard English game):

  • A word that starts with a vowel gets "way" appended: "apple" -> "appleway"
  • A word that starts with one or more consonants has that leading consonant cluster moved to the end, followed by "ay": "string" -> "ingstray"
  • "y" acts as a consonant only when it is the first letter of the word ("yellow" -> "ellowyay"); elsewhere it counts as a vowel ("myth" -> "ythmay").
  • Original capitalization of the word is preserved (title-case in, title-case out): "Hello" -> "Ellohay".
  • Trailing/leading punctuation attached to a word is preserved in place: "Hello," -> "Ellohay,".

Everything is pure strings/unicode — deterministic and reproducible on-chain.

Function

TranslateToken

func TranslateToken(token string) string

TranslateToken translates a single whitespace-delimited token, preserving any punctuation glued to its edges.

Param

Command

gnokey query vm/qeval -remote "https://rpc.topaz.testnets.gno.land" -data "gno.land/r/g12cs4cehujpffpjpywmkqj43m6u5ya53nj69sjz/piglatin.TranslateToken()"

Result