Transaction

BD386DFC2D8041…E2EA61526B7E

Block 25,993 · index 0 · indexed

Summary

Hash
BD386DFC2D804109E683105F3C48BBB132C7E9ACB788BCA18C6EE2EA61526B7E
Block
25,993
Size
4447 bytes
Gas used
8,878,268 / 10,653,981
Fee
1000000ugnot
Memo
gnopublish
Status
success

Messages

Arguments · 9

  1. #1bitsetdemo
  2. #2README.md
  3. #3# BitSet > ⚠️ **Experimental — generated with no human supervision** by the daily MCP pipeline to exercise gno tooling. Not audited. See [r/moul/x/daily](https://github.com/moul/gno-contracts/blob/main/r/moul/x/daily/README.md). --- Sieves the primes under 100 into a bit set and shows the set algebra on two small sets, rendered as a table. Demo of the [`p/moul/x/daily/bitset`](https://github.com/moul/gno-contracts/tree/main/p/moul/x/daily/bitset/v0) library — storage, popcount and every set operation come from the package; this realm does no bit-twiddling of its own. Stateless and read-only, so `Render` is fully deterministic. The sieve is a nice fit: the bit set is used *twice*, once as the composite marker and once as the result, which is exactly what a dense bit vector is for. Built for gno 0.9. <!-- BEGIN GNOCONTRACTS FOOTER (generated by `make readmes`; do not edit below) --> --- Part of **[moul/gno-contracts](https://github.com/moul/gno-contracts)** — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage. **Dependency graph:** ![gno.land/r/moul/x/daily/bitsetdemo/v0 dependency graph](https://raw.githubusercontent.com/moul/gno-contracts/main/_assets/gno.land/r/moul/x/daily/bitsetdemo/v0/deps.png) > 🧪 **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](https://github.com/moul/gno-contracts/blob/main/DISCLAIMER.md). <!-- END GNOCONTRACTS FOOTER -->
  4. #4bitsetdemo.gno
  5. #5// Package bitsetdemo is a small gnoweb demo of the dense bit vector provided by // the [p/moul/x/daily/bitset](/p/moul/x/daily/bitset/v0) library: it sieves the // primes under 100 into a bit set and shows the set algebra on two small sets. // // It contains no bit-twiddling of its own — storage, popcount and the set // operations all come from the library. Stateless, so Render is deterministic. package bitsetdemo import ( "strconv" "strings" "gno.land/p/moul/x/daily/bitset/v0" ) // limit bounds the sieve shown on the page. const limit = 100 // primes returns a bit set of the primes below limit, sieved with the bit set // itself as the composite marker. func primes() *bitset.BitSet { composite := bitset.New(limit) out := bitset.New(limit) for p := 2; p < limit; p++ { if composite.Has(p) { continue } out.Set(p) for m := p * p; m < limit; m += p { composite.Set(m) } } return out } // Render renders the demo for gnoweb. func Render(path string) string { var b strings.Builder b.WriteString("# BitSet\n\n") b.WriteString("A dense bit vector, demoing the ") b.WriteString("[`p/moul/x/daily/bitset`](/p/moul/x/daily/bitset/v0) library.\n\n") p := primes() b.WriteString("## Primes under ") b.WriteString(strconv.Itoa(limit)) b.WriteString("\n\n**") b.WriteString(strconv.Itoa(p.Count())) b.WriteString("** set bits in ") b.WriteString(strconv.Itoa(p.Cap())) b.WriteString(" bits of capacity:\n\n") b.WriteString(list(p.Slice())) small := bitset.FromSlice(16, []int{1, 2, 3, 5, 8}) even := bitset.FromSlice(16, []int{2, 4, 6, 8, 10}) b.WriteString("\n## Set algebra\n\n") b.WriteString("| set | bits |\n|---|---|\n") row(&b, "a", small) row(&b, "b", even) row(&b, "a ∪ b", bitset.Union(small, even)) row(&b, "a ∩ b", bitset.Intersect(small, even)) row(&b, "a \\ b", bitset.Difference(small, even)) row(&b, "a △ b", bitset.SymmetricDifference(small, even)) return b.String() } func row(b *strings.Builder, name string, s *bitset.BitSet) { b.WriteString("| ") b.WriteString(name) b.WriteString(" | `") b.WriteString(list1(s.Slice())) b.WriteString("` |\n") } func list(xs []int) string { if len(xs) == 0 { return "_none_\n" } return "`" + list1(xs) + "`\n" } func list1(xs []int) string { parts := []string{} for _, x := range xs { parts = append(parts, strconv.Itoa(x)) } return strings.Join(parts, " ") }
  6. #6gnomod.toml
  7. #7module = "gno.land/r/moul/x/daily/bitsetdemo/v0" gno = "0.9"
  8. #8/gno.MemPackageType
  9. #9 MPUserProd

Result log

msg:0,success:true,log:,events:[]

← Back to block 25,993