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

/p/moul/x/daily/

56 Packages
  • /p/moul/x/daily/b58/v0

    ports the core of Bitcoin's Base58 codec (à la mr-tron/base58 and btcutil/base58) to gno — as a reusable pure package.

    • Genesis
  • /p/moul/x/daily/bellmanford/v0

    finds the cheapest route from one node to every other node of a weighted directed graph whose arcs may cost LESS than nothing, as a pure, reusable package.

    • Genesis
  • /p/moul/x/daily/bidimap/v0

    bidirectional map — unique in both directions — as a pure, reusable package. A normal map answers "what is the value for this key". A bidirectional one also answers the reverse in O(1), by keeping a second index.

    • Genesis
  • /p/moul/x/daily/bitset/v0

    dense, fixed-capacity bit vector as a pure, reusable package: a compact set of small non-negative integers with the usual set algebra (union, intersection, difference).

    • Genesis
  • /p/moul/x/daily/countminsketch/v0

    estimates element frequencies in sublinear space, as a pure, reusable package. An exact frequency map costs one entry per distinct element, which on chain means unbounded storage driven by whatever users feed it.

    • Genesis
  • /p/moul/x/daily/cowsay/v0

    on-chain Gno port of the classic `cowsay` program: it builds an ASCII cow with a speech bubble containing a message — as a reusable pure package.

    • Genesis
  • /p/moul/x/daily/cowsay/v1

    on-chain Gno port of the classic `cowsay` program: it builds an ASCII cow with a speech bubble containing a message — as a reusable pure package.

    • Genesis
  • /p/moul/x/daily/crc32/v0

    implements the CRC-32 checksum as a pure, reusable package. CRC-32 treats a message as one enormous binary number and takes the remainder of dividing it by a fixed polynomial.

    • Genesis
  • /p/moul/x/daily/cron/v0

    parses the classic five-field cron expression and answers the only question a schedule exists to answer: when does it next fire.

    • Genesis
  • /p/moul/x/daily/disjointset/v0

    union-find (a disjoint-set forest) as a pure, reusable package: it tracks a partition of [0, n) into disjoint groups and answers "are these two in the same group?" in near-constant time.

    • Genesis
  • /p/moul/x/daily/fenwick/v0

    Binary Indexed Tree (Peter Fenwick, 1994): an array of int64 that answers a prefix sum and applies a point update in O(log n), with no extra storage beyond the array itself.

    • Genesis
  • /p/moul/x/daily/flatmap/v0

    sorted-vector map — the STL flat_map / Abseil btree_map trade — as a pure, reusable package. Keys and values live in two parallel sorted slices instead of a hash table or a tree of nodes.

    • Genesis
  • /p/moul/x/daily/fraction/v0

    exact rational arithmetic as a pure, reusable package: values are p/q with int64 numerator and denominator, always kept in lowest terms with a positive denominator.

    • Genesis
  • /p/moul/x/daily/geohash/v0

    encodes a latitude/longitude pair into the short base32 string known as a geohash, decodes one back into the cell it names, and walks from a cell to the eight around it.

    • Genesis
  • /p/moul/x/daily/glob/v0

    matches shell-style patterns against strings, in two modes: plain, where `*` crosses everything, and path, where `/` is a boundary that only `**` crosses. The reason to have it on chain is the allowlist.

    • Genesis
  • /p/moul/x/daily/huffman/v0

    compresses a string with canonical Huffman codes: the classic frequency-based prefix code, in the one form that is safe to put on a chain. Two properties matter here and neither is about compression. The codes are CANONICAL.

    • Genesis
  • /p/moul/x/daily/humanize/v0

    formats numbers for people rather than machines, as a pure, reusable package: byte sizes, thousands separators, ordinals, pluralisation and block-height "durations". Everything is integer-only.

    • Genesis
  • /p/moul/x/daily/humanize/v1

    formats numbers for people rather than machines, as a pure, reusable package: byte sizes, thousands separators, ordinals, pluralisation and block-height "durations". Everything is integer-only.

    • Genesis
  • /p/moul/x/daily/kmp/v0

    implements Knuth–Morris–Pratt substring search as a pure, reusable package. The naive scan re-compares characters it has already matched, so a hostile input like "aaaaaaab" in "aaaaaaaaaaaaaaab" costs O(n*m).

    • Genesis
  • /p/moul/x/daily/luhn/v0

    implements the Luhn mod-10 checksum (Hans Peter Luhn, 1954) as a pure, reusable package: the check used by credit-card numbers, IMEIs and many national ID schemes to catch typos and single-digit transpositions.

    • Genesis
  • /p/moul/x/daily/markov/v0

    deterministic Markov-chain text generator — a port of Go's canonical example "Generating arbitrary text: a Markov chain algorithm" (https://go.dev/doc/codewalk/markov/) with math/rand replaced by a caller-supplied seed.

    • Genesis
  • /p/moul/x/daily/murmur3/v0

    implements MurmurHash3 x86_32, Austin Appleby's non-cryptographic hash, as a pure, reusable package. The function reads the input four bytes at a time.

    • Genesis
  • /p/moul/x/daily/myersdiff/v0

    computes the shortest edit script between two sequences of lines, using Myers' greedy algorithm: the same one git, diff and every review tool run to turn two documents into a list of additions and deletions.

    • Genesis
  • /p/moul/x/daily/piglatin/v0

    ports the classic "Pig Latin" translator — a staple Go beginner exercise — to gno.land as a reusable pure package. Rules implemented (the standard English game):

    • Genesis
  • /p/moul/x/daily/pullpayment/v0

    escrow ledger behind the pull-payment pattern, as a pure, reusable package. The pattern is the classic Solidity answer to reentrancy: never push value to an address, credit it and let the recipient withdraw.

    • Genesis
  • /p/moul/x/daily/pullpayment/v1

    escrow ledger behind the pull-payment pattern, as a pure, reusable package. The pattern is the classic Solidity answer to reentrancy: never push value to an address, credit it and let the recipient withdraw.

    • Genesis
  • /p/moul/x/daily/ratelimit/v0

    deterministic token-bucket rate limiter — a port of golang.org/x/time/rate with the wall clock replaced by a caller-supplied monotonic tick (on-chain, that tick is the block height).

    • Genesis
  • /p/moul/x/daily/ratelimit/v1

    deterministic token-bucket rate limiter — a port of golang.org/x/time/rate with the wall clock replaced by a caller-supplied monotonic tick (on-chain, that tick is the block height).

    • Genesis
  • /p/moul/x/daily/rle/v0

    implements run-length encoding as a pure, reusable package: runs of a repeated byte collapse to a count and the byte. The encoding is `<count><char>` with counts in decimal, e.g. "aaabbc" → "3a2b1c".

    • Genesis
  • /p/moul/x/daily/romannum/v0

    pure port of the classic Roman-numeral converter kata: ToRoman / FromRoman, valid for 1..3999. Deterministic — no time, randomness or I/O — and free of any realm coupling, so it is reusable as a library.

    • Genesis
  • /p/moul/x/daily/rot13/v0

    ports Go's classic ROT13 example — the one used to teach strings.Map and io.Reader in the standard library docs — to gno as a reusable pure package.

    • Genesis
  • /p/moul/x/daily/rps/v0

    rock-paper-scissors move: parsing it, naming it, and deciding a throw. It holds no state, so every realm that plays the game agrees on what "r" means and who wins.

    • Genesis
  • /p/moul/x/daily/semver/v0

    on-chain port of the core of golang.org/x/mod/semver (and the spirit of github.com/Masterminds/semver): parse "vMAJOR.MINOR.PATCH [-prerelease][+build]" strings and compare them with correct Semantic Versioning 2.0.0…

    • Genesis
  • /p/moul/x/daily/sieve/v0

    on-chain port of Go's classic concurrent prime sieve (the "prime sieve" example from the Go tour / Go source docs), implemented as a deterministic, allocation-friendly Sieve of Eratosthenes so it runs reproducibly…

    • Genesis
  • /p/moul/x/daily/soundex/v0

    implements the Soundex phonetic algorithm as a pure, reusable package: names that sound alike in English encode to the same four-character key, so "Robert" and "Rupert" both give R163.

    • Genesis
  • /p/moul/x/daily/sparkline/v0

    renders a numeric series as one line of Unicode block characters — ▁▂▃▄▅▆▇█ — so a realm's Render can show a trend inline, with no image, no chart library and no client-side code. Everything is integer math, deliberately.

    • Genesis
  • /p/moul/x/daily/toposort/v0

    orders a dependency graph so that every node comes after everything it depends on — the "install these packages in a safe order" problem — as a pure, reusable package.

    • Genesis
  • /p/moul/x/daily/toposort/v1

    orders a dependency graph so that every node comes after everything it depends on — the "install these packages in a safe order" problem — as a pure, reusable package.

    • Genesis
  • /p/moul/x/daily/varint/v0

    implements LEB128 / protobuf-style variable-length integers over strings, with one deliberate restriction: it only accepts the canonical encoding of a value.

    • Genesis