Urbit
  • Introduction
  • Development

    • Getting Started
    • Environment Setup
    • Grants Program
    • Project Repositories
    • Precepts
    • System Overview

      • Arvo
      • Hoon
      • Nock
      • Vere
      • Azimuth
      • Cryptography
      • Arvo

        • Overview
        • Reference

          • Cryptography
          • Filesystem Hierarchy
          • Ames

            • Overview
            • Cryptography
            • API Reference
            • Behn

              • Overview
              • API Reference
              • Clay

                • Overview
                • Architecture
                • Using Clay
                • Data Types
                • Scry Reference
                • API Reference
                • Examples
                • Dill

                  • Overview
                  • API Reference
                  • Eyre

                    • Overview
                    • External API Reference
                    • Internal API Reference
                    • Scry Reference
                    • Data Types
                    • Examples
                    • Ford

                      • Overview
                      • Gall

                        • Overview
                        • Iris

                          • API Reference
                          • Jael

                            • API Reference
                            • Concepts

                              • Subscriptions
                              • Tutorials

                                • Move Trace
                              • Userspace

                                • Overview
                                • Gall

                                  • Overview
                                  • Tutorial
                                  • API Reference
                                  • Graph Store

                                    • Graph Store Overview
                                    • Data Structure Overview
                                    • Validator Walkthrough
                                    • Advanced Info
                                    • Threads

                                      • Overview
                                      • HTTP API
                                      • Reference
                                      • Basics

                                        • Fundamentals
                                        • Bind
                                        • Input
                                        • Output
                                        • Summary
                                        • Gall

                                          • Start Thread
                                          • Take Result
                                          • Take Facts
                                          • Stop Thread
                                          • Poke Thread
                                          • Examples

                                            • Fetch JSON
                                            • Child Thread
                                            • Main-loop
                                            • Poke Agent
                                            • Scry
                                            • Take Fact
                                          • Landscape

                                            • Overview
                                            • API Reference

                                              • Graph Store
                                          • Hoon

                                            • Overview
                                            • Hoon School

                                              • 1.1 Setup
                                              • 1.1.1 Walkthrough: List of Numbers
                                              • 1.2 Nouns
                                              • 1.3 Hoon Syntax
                                              • 1.3.1 Walkthrough: Conditionals
                                              • 1.4 Gates (Hoon Functions)
                                              • 1.4.1 Walkthrough: Recursion
                                              • 1.5 Lists
                                              • 1.5.1 Walkthrough: Fibonacci Sequence
                                              • 1.6 The Subject and Its Legs
                                              • 1.6.1 Walkthrough: Ackermann Function
                                              • 1.7 Arms and Cores
                                              • 1.7.1 Walkthrough: Caesar Cipher
                                              • 1.8 Doors
                                              • 1.8.1 Bank Account
                                              • 1.9 Generators
                                              • 2.1 Atoms, Auras, and Simple Cell Types
                                              • 2.2 Type Checking and Type Inference
                                              • 2.3 Structures and Complex Types
                                              • 2.3.1 Walkthrough: Libraries
                                              • 2.3.2 Molds
                                              • 2.4 Standard Library: Trees, Sets, and Maps
                                              • 2.5 Type Polymorphism
                                              • 2.5.1 Walkthrough: Iron Polymorphism and Wet Polymorphism
                                              • 2.5.2 Walkthrough: Lead Polymorphism
                                              • 2.6 Behn
                                              • 2.7 Gall
                                              • 2.7.1 Gall Walkthrough: Egg Timer
                                              • Guides

                                                • CLI apps
                                                • Parsing
                                                • Writing Aqua Tests
                                                • Reference

                                                  • Cheat Sheet
                                                  • Irregular forms
                                                  • Hoon Errors
                                                  • Hoon Style Guide
                                                  • Basic Types
                                                  • Advanced Types
                                                  • Auras
                                                  • Runes

                                                    • Atoms and strings
                                                    • Nock . ('dot')
                                                    • Wild ! ('zap')
                                                    • Change Subject = ('tis')
                                                    • Conditionals ? ('wut')
                                                    • Cores | ('bar')
                                                    • Arms + ('lus')
                                                    • Cells : ('col')
                                                    • Calls % ('cen')
                                                    • Casts ^ ('ket')
                                                    • Structures $ ('buc')
                                                    • Make ; ('mic')
                                                    • Hints ~ ('sig')
                                                    • Terminators -- and ==
                                                    • Limbs and wings

                                                      • Limbs
                                                      • Wings
                                                      • Standard library

                                                        • Table of Contents
                                                        • 1a: Basic Arithmetic
                                                        • 1b: Tree Addressing
                                                        • 1c: Molds and Mold-Builders
                                                        • 2a: Unit Logic
                                                        • 2b: List Logic
                                                        • 2c: Bit Arithmetic
                                                        • 2d: Bit Logic
                                                        • 2e: Insecure Hashing
                                                        • 2f: Noun Ordering
                                                        • 2g: Unsigned Powers
                                                        • 2h: Set Logic
                                                        • 2i: Map Logic
                                                        • 2j: Jar and Jug Logic
                                                        • 2k: Queue Logic
                                                        • 2l: Container from Container
                                                        • 2m: Container from Noun
                                                        • 2n: Functional Hacks
                                                        • 2o: Normalizing Containers
                                                        • 2p: Serialization
                                                        • 2q: Molds and Mold-Builders
                                                        • 3a: Modular and Signed Ints
                                                        • 3b: Floating Point
                                                        • 3c: Urbit Time
                                                        • 3d: SHA Hash Family
                                                        • 3e: AES encryption (Removed)
                                                        • 3f: Scrambling
                                                        • 3g: Molds and Mold-Builders
                                                        • 4a: Exotic Bases
                                                        • 4b: Text Processing
                                                        • 4c: Tank Printer
                                                        • 4d: Parsing (Tracing)
                                                        • 4e: Parsing (Combinators)
                                                        • 4f: Parsing (Rule-Builders)
                                                        • 4g: Parsing (Outside Caller)
                                                        • 4h: Parsing (ASCII Glyphs)
                                                        • 4i: Parsing (Useful Idioms)
                                                        • 4j: Parsing (Bases and Base Digits)
                                                        • 4k: Atom Printing
                                                        • 4l: Atom Parsing
                                                        • 4m: Formatting Functions
                                                        • 4n: Virtualization
                                                        • 4o: Molds
                                                        • 5a: Compiler Utilities
                                                        • 5b: Macro Expansion
                                                        • 5c: Compiler Backend & Prettyprinter
                                                        • 5d: Parser
                                                        • 5e: Caching Compiler
                                                        • 5f: Molds and Mold-Builders
                                                        • 5g: profiling support
                                                    • Nock

                                                      • Nock Definition
                                                      • Explanation
                                                      • Example
                                                      • Implementations
                                                      • Vere

                                                        • C Runtime System
                                                        • Land of Nouns
                                                        • API overview by prefix
                                                        • C in Urbit
                                                        • Writing Jets
                                                        • Cryptography
                                                        • Azimuth

                                                          • Overview
                                                          • Life and Rift
                                                          • Advanced Azimuth Tools
                                                          • Glossary

                                                            • Ames
                                                            • Aqua
                                                            • Arm
                                                            • Arvo
                                                            • Atom
                                                            • Azimuth
                                                            • Battery
                                                            • Behn
                                                            • Breach
                                                            • Bridge
                                                            • Censures
                                                            • Ceremony
                                                            • chat
                                                            • Claims
                                                            • Clay
                                                            • Comet
                                                            • Core
                                                            • Delegated Sending
                                                            • Desk
                                                            • Dill
                                                            • Document Proposal
                                                            • Dojo
                                                            • Door
                                                            • Ecliptic
                                                            • Event Log
                                                            • Eyre
                                                            • Ford
                                                            • Galaxy
                                                            • Gall
                                                            • Gate
                                                            • HD Wallet
                                                            • Hoon
                                                            • Invite Tree
                                                            • Iris
                                                            • Jael
                                                            • Jaque
                                                            • Keyfile
                                                            • Landscape
                                                            • Mark
                                                            • Moon
                                                            • Nock
                                                            • Noun
                                                            • OTA Updates
                                                            • Payload
                                                            • pH
                                                            • Pier
                                                            • Pill
                                                            • Planet
                                                            • Proxies
                                                            • Replay
                                                            • Sail/Udon
                                                            • Senate
                                                            • Ship
                                                            • ship.arvo.network
                                                            • Star
                                                            • |sync
                                                            • Trap
                                                            • Upgrade Proposal
                                                            • Vane
                                                            • Vere
                                                            • Voting
                                                            • Wallet-Generator
                                                            Urbit
                                                            • Introduction
                                                            • Development

                                                              • Getting Started
                                                              • Environment Setup
                                                              • Grants Program
                                                              • Project Repositories
                                                              • Precepts
                                                              • System Overview

                                                                • Arvo
                                                                • Hoon
                                                                • Nock
                                                                • Vere
                                                                • Azimuth
                                                                • Cryptography
                                                                • Arvo

                                                                  • Overview
                                                                  • Reference

                                                                    • Cryptography
                                                                    • Filesystem Hierarchy
                                                                    • Ames

                                                                      • Overview
                                                                      • Cryptography
                                                                      • API Reference
                                                                      • Behn

                                                                        • Overview
                                                                        • API Reference
                                                                        • Clay

                                                                          • Overview
                                                                          • Architecture
                                                                          • Using Clay
                                                                          • Data Types
                                                                          • Scry Reference
                                                                          • API Reference
                                                                          • Examples
                                                                          • Dill

                                                                            • Overview
                                                                            • API Reference
                                                                            • Eyre

                                                                              • Overview
                                                                              • External API Reference
                                                                              • Internal API Reference
                                                                              • Scry Reference
                                                                              • Data Types
                                                                              • Examples
                                                                              • Ford

                                                                                • Overview
                                                                                • Gall

                                                                                  • Overview
                                                                                  • Iris

                                                                                    • API Reference
                                                                                    • Jael

                                                                                      • API Reference
                                                                                      • Concepts

                                                                                        • Subscriptions
                                                                                        • Tutorials

                                                                                          • Move Trace
                                                                                        • Userspace

                                                                                          • Overview
                                                                                          • Gall

                                                                                            • Overview
                                                                                            • Tutorial
                                                                                            • API Reference
                                                                                            • Graph Store

                                                                                              • Graph Store Overview
                                                                                              • Data Structure Overview
                                                                                              • Validator Walkthrough
                                                                                              • Advanced Info
                                                                                              • Threads

                                                                                                • Overview
                                                                                                • HTTP API
                                                                                                • Reference
                                                                                                • Basics

                                                                                                  • Fundamentals
                                                                                                  • Bind
                                                                                                  • Input
                                                                                                  • Output
                                                                                                  • Summary
                                                                                                  • Gall

                                                                                                    • Start Thread
                                                                                                    • Take Result
                                                                                                    • Take Facts
                                                                                                    • Stop Thread
                                                                                                    • Poke Thread
                                                                                                    • Examples

                                                                                                      • Fetch JSON
                                                                                                      • Child Thread
                                                                                                      • Main-loop
                                                                                                      • Poke Agent
                                                                                                      • Scry
                                                                                                      • Take Fact
                                                                                                    • Landscape

                                                                                                      • Overview
                                                                                                      • API Reference

                                                                                                        • Graph Store
                                                                                                    • Hoon

                                                                                                      • Overview
                                                                                                      • Hoon School

                                                                                                        • 1.1 Setup
                                                                                                        • 1.1.1 Walkthrough: List of Numbers
                                                                                                        • 1.2 Nouns
                                                                                                        • 1.3 Hoon Syntax
                                                                                                        • 1.3.1 Walkthrough: Conditionals
                                                                                                        • 1.4 Gates (Hoon Functions)
                                                                                                        • 1.4.1 Walkthrough: Recursion
                                                                                                        • 1.5 Lists
                                                                                                        • 1.5.1 Walkthrough: Fibonacci Sequence
                                                                                                        • 1.6 The Subject and Its Legs
                                                                                                        • 1.6.1 Walkthrough: Ackermann Function
                                                                                                        • 1.7 Arms and Cores
                                                                                                        • 1.7.1 Walkthrough: Caesar Cipher
                                                                                                        • 1.8 Doors
                                                                                                        • 1.8.1 Bank Account
                                                                                                        • 1.9 Generators
                                                                                                        • 2.1 Atoms, Auras, and Simple Cell Types
                                                                                                        • 2.2 Type Checking and Type Inference
                                                                                                        • 2.3 Structures and Complex Types
                                                                                                        • 2.3.1 Walkthrough: Libraries
                                                                                                        • 2.3.2 Molds
                                                                                                        • 2.4 Standard Library: Trees, Sets, and Maps
                                                                                                        • 2.5 Type Polymorphism
                                                                                                        • 2.5.1 Walkthrough: Iron Polymorphism and Wet Polymorphism
                                                                                                        • 2.5.2 Walkthrough: Lead Polymorphism
                                                                                                        • 2.6 Behn
                                                                                                        • 2.7 Gall
                                                                                                        • 2.7.1 Gall Walkthrough: Egg Timer
                                                                                                        • Guides

                                                                                                          • CLI apps
                                                                                                          • Parsing
                                                                                                          • Writing Aqua Tests
                                                                                                          • Reference

                                                                                                            • Cheat Sheet
                                                                                                            • Irregular forms
                                                                                                            • Hoon Errors
                                                                                                            • Hoon Style Guide
                                                                                                            • Basic Types
                                                                                                            • Advanced Types
                                                                                                            • Auras
                                                                                                            • Runes

                                                                                                              • Atoms and strings
                                                                                                              • Nock . ('dot')
                                                                                                              • Wild ! ('zap')
                                                                                                              • Change Subject = ('tis')
                                                                                                              • Conditionals ? ('wut')
                                                                                                              • Cores | ('bar')
                                                                                                              • Arms + ('lus')
                                                                                                              • Cells : ('col')
                                                                                                              • Calls % ('cen')
                                                                                                              • Casts ^ ('ket')
                                                                                                              • Structures $ ('buc')
                                                                                                              • Make ; ('mic')
                                                                                                              • Hints ~ ('sig')
                                                                                                              • Terminators -- and ==
                                                                                                              • Limbs and wings

                                                                                                                • Limbs
                                                                                                                • Wings
                                                                                                                • Standard library

                                                                                                                  • Table of Contents
                                                                                                                  • 1a: Basic Arithmetic
                                                                                                                  • 1b: Tree Addressing
                                                                                                                  • 1c: Molds and Mold-Builders
                                                                                                                  • 2a: Unit Logic
                                                                                                                  • 2b: List Logic
                                                                                                                  • 2c: Bit Arithmetic
                                                                                                                  • 2d: Bit Logic
                                                                                                                  • 2e: Insecure Hashing
                                                                                                                  • 2f: Noun Ordering
                                                                                                                  • 2g: Unsigned Powers
                                                                                                                  • 2h: Set Logic
                                                                                                                  • 2i: Map Logic
                                                                                                                  • 2j: Jar and Jug Logic
                                                                                                                  • 2k: Queue Logic
                                                                                                                  • 2l: Container from Container
                                                                                                                  • 2m: Container from Noun
                                                                                                                  • 2n: Functional Hacks
                                                                                                                  • 2o: Normalizing Containers
                                                                                                                  • 2p: Serialization
                                                                                                                  • 2q: Molds and Mold-Builders
                                                                                                                  • 3a: Modular and Signed Ints
                                                                                                                  • 3b: Floating Point
                                                                                                                  • 3c: Urbit Time
                                                                                                                  • 3d: SHA Hash Family
                                                                                                                  • 3e: AES encryption (Removed)
                                                                                                                  • 3f: Scrambling
                                                                                                                  • 3g: Molds and Mold-Builders
                                                                                                                  • 4a: Exotic Bases
                                                                                                                  • 4b: Text Processing
                                                                                                                  • 4c: Tank Printer
                                                                                                                  • 4d: Parsing (Tracing)
                                                                                                                  • 4e: Parsing (Combinators)
                                                                                                                  • 4f: Parsing (Rule-Builders)
                                                                                                                  • 4g: Parsing (Outside Caller)
                                                                                                                  • 4h: Parsing (ASCII Glyphs)
                                                                                                                  • 4i: Parsing (Useful Idioms)
                                                                                                                  • 4j: Parsing (Bases and Base Digits)
                                                                                                                  • 4k: Atom Printing
                                                                                                                  • 4l: Atom Parsing
                                                                                                                  • 4m: Formatting Functions
                                                                                                                  • 4n: Virtualization
                                                                                                                  • 4o: Molds
                                                                                                                  • 5a: Compiler Utilities
                                                                                                                  • 5b: Macro Expansion
                                                                                                                  • 5c: Compiler Backend & Prettyprinter
                                                                                                                  • 5d: Parser
                                                                                                                  • 5e: Caching Compiler
                                                                                                                  • 5f: Molds and Mold-Builders
                                                                                                                  • 5g: profiling support
                                                                                                              • Nock

                                                                                                                • Nock Definition
                                                                                                                • Explanation
                                                                                                                • Example
                                                                                                                • Implementations
                                                                                                                • Vere

                                                                                                                  • C Runtime System
                                                                                                                  • Land of Nouns
                                                                                                                  • API overview by prefix
                                                                                                                  • C in Urbit
                                                                                                                  • Writing Jets
                                                                                                                  • Cryptography
                                                                                                                  • Azimuth

                                                                                                                    • Overview
                                                                                                                    • Life and Rift
                                                                                                                    • Advanced Azimuth Tools
                                                                                                                    • Glossary

                                                                                                                      • Ames
                                                                                                                      • Aqua
                                                                                                                      • Arm
                                                                                                                      • Arvo
                                                                                                                      • Atom
                                                                                                                      • Azimuth
                                                                                                                      • Battery
                                                                                                                      • Behn
                                                                                                                      • Breach
                                                                                                                      • Bridge
                                                                                                                      • Censures
                                                                                                                      • Ceremony
                                                                                                                      • chat
                                                                                                                      • Claims
                                                                                                                      • Clay
                                                                                                                      • Comet
                                                                                                                      • Core
                                                                                                                      • Delegated Sending
                                                                                                                      • Desk
                                                                                                                      • Dill
                                                                                                                      • Document Proposal
                                                                                                                      • Dojo
                                                                                                                      • Door
                                                                                                                      • Ecliptic
                                                                                                                      • Event Log
                                                                                                                      • Eyre
                                                                                                                      • Ford
                                                                                                                      • Galaxy
                                                                                                                      • Gall
                                                                                                                      • Gate
                                                                                                                      • HD Wallet
                                                                                                                      • Hoon
                                                                                                                      • Invite Tree
                                                                                                                      • Iris
                                                                                                                      • Jael
                                                                                                                      • Jaque
                                                                                                                      • Keyfile
                                                                                                                      • Landscape
                                                                                                                      • Mark
                                                                                                                      • Moon
                                                                                                                      • Nock
                                                                                                                      • Noun
                                                                                                                      • OTA Updates
                                                                                                                      • Payload
                                                                                                                      • pH
                                                                                                                      • Pier
                                                                                                                      • Pill
                                                                                                                      • Planet
                                                                                                                      • Proxies
                                                                                                                      • Replay
                                                                                                                      • Sail/Udon
                                                                                                                      • Senate
                                                                                                                      • Ship
                                                                                                                      • ship.arvo.network
                                                                                                                      • Star
                                                                                                                      • |sync
                                                                                                                      • Trap
                                                                                                                      • Upgrade Proposal
                                                                                                                      • Vane
                                                                                                                      • Vere
                                                                                                                      • Voting
                                                                                                                      • Wallet-Generator
                                                                                                                      Urbit/Documentation/Hoon/Reference/Standard library

                                                                                                                      4l: Atom Parsing

                                                                                                                      ++so

                                                                                                                      Coin parser engine

                                                                                                                      Core containing arms that parse ++coin.

                                                                                                                      Accepts

                                                                                                                      Produces

                                                                                                                      Source

                                                                                                                      ++  so
                                                                                                                            |%
                                                                                                                      

                                                                                                                      Examples

                                                                                                                          > so
                                                                                                                          <10.mkn 414.hhh 100.xkc 1.ypj %164>

                                                                                                                      ++bisk:so

                                                                                                                      Parse aura-atom pair

                                                                                                                      Parsing rule. Parses an unsigned integer of any permitted base, producing a ++dime.

                                                                                                                      Accepts

                                                                                                                      Produces

                                                                                                                      Source

                                                                                                                      ++  bisk
                                                                                                                              ;~  pose
                                                                                                                                ;~  pfix  (just '0')
                                                                                                                                  ;~  pose
                                                                                                                                    (stag %ub ;~(pfix (just 'b') bay:ag))
                                                                                                                                    (stag %ui ;~(pfix (just 'i') dim:ag))
                                                                                                                                    (stag %ux ;~(pfix (just 'x') hex:ag))
                                                                                                                                    (stag %uv ;~(pfix (just 'v') viz:ag))
                                                                                                                                    (stag %uw ;~(pfix (just 'w') wiz:ag))
                                                                                                                                  ==
                                                                                                                                ==
                                                                                                                                (stag %ud dem:ag)
                                                                                                                              ==
                                                                                                                      

                                                                                                                      Examples

                                                                                                                          > (scan "25" bisk:so)
                                                                                                                          [%ud q=25]
                                                                                                                          > (scan "0x12.6401" bisk:so)
                                                                                                                          [%ux q=1.205.249]

                                                                                                                      ++crub:so

                                                                                                                      Parse @da, @dr, @p, @t

                                                                                                                      Parsing rule. Parses any atom of any of the following auras after a leading sig, ~ into a ++dime: @da, @dr, @p, and @t, producing a ++dime.

                                                                                                                      Accepts

                                                                                                                      Produces

                                                                                                                      Source

                                                                                                                      ++  crub
                                                                                                                              ~+
                                                                                                                              ;~  pose
                                                                                                                                %+  cook
                                                                                                                                  |=(det/date `dime`[%da (year det)])
                                                                                                                                ;~  plug
                                                                                                                                  %+  cook
                                                                                                                                    |=({a/@ b/?} [b a])
                                                                                                                                  ;~(plug dim:ag ;~(pose (cold | hep) (easy &)))
                                                                                                                                  ;~(pfix dot dim:ag)   ::  month
                                                                                                                                  ;~(pfix dot dim:ag)   ::  day
                                                                                                                                  ;~  pose
                                                                                                                                    ;~  pfix
                                                                                                                                      ;~(plug dot dot)
                                                                                                                                      ;~  plug
                                                                                                                                        dum:ag
                                                                                                                                        ;~(pfix dot dum:ag)
                                                                                                                                        ;~(pfix dot dum:ag)
                                                                                                                                        ;~(pose ;~(pfix ;~(plug dot dot) (most dot qix:ab)) (easy ~))
                                                                                                                                      ==
                                                                                                                                    ==
                                                                                                                                    (easy [0 0 0 ~])
                                                                                                                                  ==
                                                                                                                                ==
                                                                                                                              ::
                                                                                                                                %+  cook
                                                                                                                                  |=  {a/(list {p/?($d $h $m $s) q/@}) b/(list @)}
                                                                                                                                  =+  rop=`tarp`[0 0 0 0 b]
                                                                                                                                  |-  ^-  dime
                                                                                                                                  ?~  a
                                                                                                                                    [%dr (yule rop)]
                                                                                                                                  ?-  p.i.a
                                                                                                                                    $d  $(a t.a, d.rop (add q.i.a d.rop))
                                                                                                                                    $h  $(a t.a, h.rop (add q.i.a h.rop))
                                                                                                                                    $m  $(a t.a, m.rop (add q.i.a m.rop))
                                                                                                                                    $s  $(a t.a, s.rop (add q.i.a s.rop))
                                                                                                                                  ==
                                                                                                                                ;~  plug
                                                                                                                                  %+  most
                                                                                                                                    dot
                                                                                                                                  ;~  pose
                                                                                                                                    ;~(pfix (just 'd') (stag %d dim:ag))
                                                                                                                                    ;~(pfix (just 'h') (stag %h dim:ag))
                                                                                                                                    ;~(pfix (just 'm') (stag %m dim:ag))
                                                                                                                                    ;~(pfix (just 's') (stag %s dim:ag))
                                                                                                                                  ==
                                                                                                                                  ;~(pose ;~(pfix ;~(plug dot dot) (most dot qix:ab)) (easy ~))
                                                                                                                                ==
                                                                                                                              ::
                                                                                                                                (stag %p fed:ag)
                                                                                                                                ;~(pfix dot (stag %ta urs:ab))
                                                                                                                                ;~(pfix sig (stag %t urx:ab))
                                                                                                                                ;~(pfix hep (stag %c (cook turf urx:ab)))
                                                                                                                              ==
                                                                                                                            ++  nuck
                                                                                                                              ~/  %nuck  |=  a/nail  %.  a
                                                                                                                              %+  knee  *coin  |.  ~+
                                                                                                                              %-  stew
                                                                                                                              ^.  stet  ^.  limo
                                                                                                                              :~  :-  ['a' 'z']  (cook |=(a/@ta [%$ %tas a]) sym)
                                                                                                                                  :-  ['0' '9']  (stag %$ bisk)
                                                                                                                                  :-  '-'        (stag %$ tash)
                                                                                                                                  :-  '.'        ;~(pfix dot perd)
                                                                                                                                  :-  '~'        ;~(pfix sig ;~(pose twid (easy [%$ %n 0])))
                                                                                                                              ==
                                                                                                                            ++  nusk
                                                                                                                              ~+
                                                                                                                              :(sear |=(a/@ta (rush a nuck)) wick urt:ab)
                                                                                                                            ++  perd
                                                                                                                              ~+
                                                                                                                              ;~  pose
                                                                                                                                (stag %$ zust)
                                                                                                                                (stag %many (ifix [cab ;~(plug cab cab)] (more cab nusk)))
                                                                                                                              ==
                                                                                                                            ++  royl
                                                                                                                              ~+
                                                                                                                              =+  ^=  moo
                                                                                                                                |=  a/tape
                                                                                                                                :-  (lent a)
                                                                                                                                (scan a (bass 10 (plus sid:ab)))
                                                                                                                              =+  ^=  voy
                                                                                                                                %+  cook  royl-cell
                                                                                                                                ;~  pose
                                                                                                                                  ;~  plug
                                                                                                                                    (easy %d)
                                                                                                                                    ;~  pose  (cold | hep)  (easy &)  ==
                                                                                                                                    ;~  plug  dim:ag
                                                                                                                                      ;~  pose
                                                                                                                                        ;~(pfix dot (cook moo (plus (shim '0' '9'))))
                                                                                                                                        (easy [0 0])
                                                                                                                                      ==
                                                                                                                                      ;~  pose
                                                                                                                                        ;~  pfix
                                                                                                                                          (just 'e')
                                                                                                                                          ;~(plug ;~(pose (cold | hep) (easy &)) dim:ag)
                                                                                                                                        ==
                                                                                                                                        (easy [& 0])
                                                                                                                                      ==
                                                                                                                                    ==
                                                                                                                                  ==
                                                                                                                                  ;~  plug
                                                                                                                                    (easy %i)
                                                                                                                                    ;~  sfix
                                                                                                                                      ;~  pose  (cold | hep)  (easy &)  ==
                                                                                                                                      (jest 'inf')
                                                                                                                                    ==
                                                                                                                                  ==
                                                                                                                                  ;~  plug
                                                                                                                                    (easy %n)
                                                                                                                                    (cold ~ (jest 'nan'))
                                                                                                                                  ==
                                                                                                                                ==
                                                                                                                              ;~  pose
                                                                                                                                (stag %rh (cook rylh ;~(pfix ;~(plug sig sig) voy)))
                                                                                                                                (stag %rq (cook rylq ;~(pfix ;~(plug sig sig sig) voy)))
                                                                                                                                (stag %rd (cook ryld ;~(pfix sig voy)))
                                                                                                                                (stag %rs (cook ryls voy))
                                                                                                                              ==
                                                                                                                            ::
                                                                                                                            ++  royl-cell
                                                                                                                              |=  rn
                                                                                                                              ^-  dn
                                                                                                                              ?.  ?=({$d *} +<)  +<
                                                                                                                              =+  ^=  h
                                                                                                                                (dif:si (new:si f.b i.b) (sun:si d.b))
                                                                                                                              [%d a h (add (mul c.b (pow 10 d.b)) e.b)]
                                                                                                                            ::
                                                                                                                            ++  tash
                                                                                                                              ~+
                                                                                                                              =+  ^=  neg
                                                                                                                                  |=  {syn/? mol/dime}  ^-  dime
                                                                                                                                  ?>  =('u' (end 3 1 p.mol))
                                                                                                                                  [(cat 3 's' (rsh 3 1 p.mol)) (new:si syn q.mol)]
                                                                                                                              ;~  pfix  hep
                                                                                                                                ;~  pose
                                                                                                                                  (cook |=(a/dime (neg | a)) bisk)
                                                                                                                                  ;~(pfix hep (cook |=(a/dime (neg & a)) bisk))
                                                                                                                                ==
                                                                                                                              ==
                                                                                                                            ::
                                                                                                                            ++  twid
                                                                                                                              ~+
                                                                                                                              ;~  pose
                                                                                                                                (cook |=(a/@ [%blob (cue a)]) ;~(pfix (just '0') vum:ag))
                                                                                                                                (stag %$ crub)
                                                                                                                              ==
                                                                                                                            ::
                                                                                                                            ++  zust
                                                                                                                              ~+
                                                                                                                              ;~  pose
                                                                                                                                (stag %is bip:ag)
                                                                                                                                (stag %if lip:ag)
                                                                                                                                (stag %f ;~(pose (cold & (just 'y')) (cold | (just 'n'))))
                                                                                                                                royl
                                                                                                                              ==
                                                                                                                            --
                                                                                                                      

                                                                                                                      Examples

                                                                                                                          > (scan "1926.5.12" crub:so)
                                                                                                                          [p=~.da q=170.141.184.449.747.016.871.285.095.307.149.312.000]
                                                                                                                          > ([%da @da] (scan "1926.5.12" crub:so))
                                                                                                                          [%da ~1926.5.12]
                                                                                                                          > (scan "s10" crub:so)
                                                                                                                          [p=~.dr q=184.467.440.737.095.516.160]
                                                                                                                          > ([%dr @dr] (scan "s10" crub:so))
                                                                                                                          [%dr ~s10]
                                                                                                                          > (scan "doznec" crub:so)
                                                                                                                          [%p 256]
                                                                                                                          > (scan ".mas" crub:so)
                                                                                                                          [%ta 7.561.581]

                                                                                                                      ++nuck:so

                                                                                                                      Top-level coin parser

                                                                                                                      Parsing rule. Switches on the first character and applies the corresponding ++coin parser.

                                                                                                                      Accepts

                                                                                                                      Produces

                                                                                                                      Source

                                                                                                                      ++  nuck
                                                                                                                                ~/  %nuck  |=  a/nail  %.  a
                                                                                                                                %+  knee  *coin  |.  ~+
                                                                                                                                %-  stew
                                                                                                                                ^.  stet  ^.  limo
                                                                                                                                :~  :-  ['a' 'z']  (cook |=(a/@ta [%$ %tas a]) sym)
                                                                                                                                    :-  ['0' '9']  (stag %$ bisk)
                                                                                                                                    :-  '-'        (stag %$ tash)
                                                                                                                                    :-  '.'        ;~(pfix dot perd)
                                                                                                                                    :-  '~'        ;~(pfix sig ;~(pose twid (easy [%$ %n 0])))
                                                                                                                                ==
                                                                                                                      

                                                                                                                      Examples

                                                                                                                          > (scan "~pillyt" nuck:so)
                                                                                                                          [% p=[p=~.p q=32.819]]
                                                                                                                          > (scan "0x12" nuck:so)
                                                                                                                          [% p=[p=~.ux q=18]]
                                                                                                                          > (scan ".127.0.0.1" nuck:so)
                                                                                                                          [% p=[p=~.if q=2.130.706.433]]
                                                                                                                          > `@ud`.127.0.0.1
                                                                                                                          2.130.706.433
                                                                                                                          > (scan "._20_0w25_sam__" nuck:so)
                                                                                                                          [ %many
                                                                                                                              p
                                                                                                                            ~[[% p=[p=~.ud q=20]] [% p=[p=~.uw q=133]] [% p=[p=~.tas q=7.168.371]]]
                                                                                                                          ]
                                                                                                                          > `@`%sam
                                                                                                                          7.168.371
                                                                                                                          > (scan "~0ph" nuck:so)
                                                                                                                          [%blob p=[1 1]]
                                                                                                                          > ~0ph
                                                                                                                          [1 1]
                                                                                                                          > `@uv`(jam [1 1])
                                                                                                                          0vph

                                                                                                                      ++nusk:so

                                                                                                                      Parse coin literal with escapes

                                                                                                                      Parsing rule. Parses a coin literal with escapes. (See also: xx tuple formatting).

                                                                                                                      Accepts

                                                                                                                      Produces

                                                                                                                      Source

                                                                                                                      ++  nusk
                                                                                                                              (sear |=(a/@ta (rush (wick a) nuck)) urt:ab)
                                                                                                                      

                                                                                                                      Examples

                                                                                                                          > ~.asd_a
                                                                                                                          ~.asd_a
                                                                                                                          > ._1_~~.asd~-a__
                                                                                                                          [1 ~.asd_a]
                                                                                                                          > (scan "~~.asd~-a" nusk:so)
                                                                                                                          [% p=[p=~.ta q=418.212.246.369]]
                                                                                                                          > ([~ %ta @ta] (scan "~~.asd~-a" nusk:so))
                                                                                                                          [~ %ta ~.asd_a]

                                                                                                                      ++perd:so

                                                                                                                      Parsing rule.

                                                                                                                      Parsing rule. Parses a dime or tuple without their respective standard prefixes.

                                                                                                                      Accepts

                                                                                                                      Produces

                                                                                                                      Source

                                                                                                                      ++  perd
                                                                                                                              ;~  pose
                                                                                                                                (stag ~ zust)
                                                                                                                                (stag %many (ifix [cab ;~(plug cab cab)] (more cab nusk)))
                                                                                                                              ==
                                                                                                                      

                                                                                                                      Examples

                                                                                                                          > (scan "y" perd:so)
                                                                                                                          [~ [%f %.y]]
                                                                                                                          > (scan "n" perd:so)
                                                                                                                          [~ [%f %.n]]
                                                                                                                          > |
                                                                                                                          %.n
                                                                                                                          > (scan "_20_x__" perd:so)
                                                                                                                          [%many [[% p=[p=~.ud q=20]] ~[[% p=[p=~.tas q=120]]]]]

                                                                                                                      ++royl:so

                                                                                                                      Parse dime float

                                                                                                                      Parsing rule. Parses a number into a ++dime float.

                                                                                                                      Accepts

                                                                                                                      Produces

                                                                                                                      Source

                                                                                                                      ++  royl
                                                                                                                          ~+
                                                                                                                          =+  ^=  moo
                                                                                                                            |=  a/tape
                                                                                                                            :-  (lent a)
                                                                                                                            (scan a (bass 10 (plus sid:ab)))
                                                                                                                          =+  ^=  voy
                                                                                                                            %+  cook  royl-cell
                                                                                                                            ;~  pose
                                                                                                                              ;~  plug
                                                                                                                                (easy %d)
                                                                                                                                ;~  pose  (cold | hep)  (easy &)  ==
                                                                                                                                ;~  plug  dim:ag
                                                                                                                                  ;~  pose
                                                                                                                                    ;~(pfix dot (cook moo (plus (shim '0' '9'))))
                                                                                                                                    (easy [0 0])
                                                                                                                                  ==
                                                                                                                                  ;~  pose
                                                                                                                                    ;~  pfix
                                                                                                                                      (just 'e')
                                                                                                                                      ;~(plug ;~(pose (cold | hep) (easy &)) dim:ag)
                                                                                                                                    ==
                                                                                                                                    (easy [& 0])
                                                                                                                                  ==
                                                                                                                                ==
                                                                                                                              ==
                                                                                                                              ;~  plug
                                                                                                                                (easy %i)
                                                                                                                                ;~  sfix
                                                                                                                                  ;~  pose  (cold | hep)  (easy &)  ==
                                                                                                                                  (jest 'inf')
                                                                                                                                ==
                                                                                                                              ==
                                                                                                                              ;~  plug
                                                                                                                                (easy %n)
                                                                                                                                (cold ~ (jest 'nan'))
                                                                                                                              ==
                                                                                                                            ==
                                                                                                                          ;~  pose
                                                                                                                            (stag %rh (cook rylh ;~(pfix ;~(plug sig sig) voy)))
                                                                                                                            (stag %rq (cook rylq ;~(pfix ;~(plug sig sig sig) voy)))
                                                                                                                            (stag %rd (cook ryld ;~(pfix sig voy)))
                                                                                                                            (stag %rs (cook ryls voy))
                                                                                                                          ==
                                                                                                                        ::
                                                                                                                      

                                                                                                                      Examples

                                                                                                                          > (scan "~3.14" royl:so)
                                                                                                                          [%rd .~3.13999999999999]
                                                                                                                          > .~3.14
                                                                                                                          .~3.13999999999999

                                                                                                                      ++royl-cell:so

                                                                                                                      XX still not fully functional

                                                                                                                      Intermediate parsed float convereter

                                                                                                                      ++  royl-cell
                                                                                                                              |=  rn
                                                                                                                              ^-  dn
                                                                                                                              ?.  ?=({$d *} +<)  +<
                                                                                                                              =+  ^=  h
                                                                                                                                (dif:si (new:si f.b i.b) (sun:si d.b))
                                                                                                                              [%d a h (add (mul c.b (pow 10 d.b)) e.b)]
                                                                                                                            ::
                                                                                                                      

                                                                                                                      ++tash:so

                                                                                                                      Parse signed dime

                                                                                                                      Accepts

                                                                                                                      Produces

                                                                                                                      Parsing rule. Parses a signed number into a ++dime.

                                                                                                                      Source

                                                                                                                      ++  tash
                                                                                                                              ~+
                                                                                                                              =+  ^=  neg
                                                                                                                                  |=  {syn/? mol/dime}  ^-  dime
                                                                                                                                  ?>  =('u' (end 3 1 p.mol))
                                                                                                                                  [(cat 3 's' (rsh 3 1 p.mol)) (new:si syn q.mol)]
                                                                                                                              ;~  pfix  hep
                                                                                                                                ;~  pose
                                                                                                                                  (cook |=(a/dime (neg | a)) bisk)
                                                                                                                                  ;~(pfix hep (cook |=(a/dime (neg & a)) bisk))
                                                                                                                                ==
                                                                                                                              ==
                                                                                                                            ::
                                                                                                                      

                                                                                                                      Examples

                                                                                                                          > (scan "-20" tash:so)
                                                                                                                          [p=~.sd q=39]
                                                                                                                          > (,[%sd @sd] (scan "-20" tash:so))
                                                                                                                          [%sd -20]
                                                                                                                          > (,[%sd @sd] (scan "--20" tash:so))
                                                                                                                          [%sd --20]
                                                                                                                          > (,[%sx @sx] (scan "--0x2e" tash:so))
                                                                                                                          [%sx --0x2e]

                                                                                                                      ++twid:so

                                                                                                                      Parse coins without ~ prefix

                                                                                                                      Parsing rule. Parses coins after a leading sig, ~.

                                                                                                                      Accepts

                                                                                                                      Produces

                                                                                                                      Source

                                                                                                                      ++  twid
                                                                                                                              ;~  pose
                                                                                                                                (cook |=(a/@ [%blob (cue a)]) ;~(pfix (just '0') vum:ag))
                                                                                                                                (stag ~ crub)
                                                                                                                              ==
                                                                                                                            ::
                                                                                                                      

                                                                                                                      Examples

                                                                                                                          > (scan "zod" twid:so)
                                                                                                                          [~ [%p 0]]
                                                                                                                          > (scan ".sam" twid:so)
                                                                                                                          [~ [%ta 7.168.371]]
                                                                                                                          > `@ud`~.sam
                                                                                                                          7.168.371
                                                                                                                          > `@t`~.sam
                                                                                                                          'sam'
                                                                                                                          > (scan "0ph" twid:so)
                                                                                                                          [%blob [1 1]]

                                                                                                                      ++zust:so

                                                                                                                      Parse prefixed dimes from @if, @f, @rd

                                                                                                                      Parsing rule. Parses an atom of either @if (IP address), @f (loobean), or rf(floating point) into a ++dime.

                                                                                                                      Accepts

                                                                                                                      Produces

                                                                                                                      Source

                                                                                                                      ++  zust
                                                                                                                              ;~  pose
                                                                                                                                (stag %is bip:ag)
                                                                                                                                (stag %if lip:ag)
                                                                                                                                (stag %f ;~(pose (cold & (just 'y')) (cold | (just 'n'))))
                                                                                                                                royl
                                                                                                                              ==
                                                                                                                            --
                                                                                                                      

                                                                                                                      Examples

                                                                                                                          > (scan "127.0.0.1" zust:so)
                                                                                                                          [%if q=2.130.706.433]
                                                                                                                      
                                                                                                                          > (scan "af.0.0.0.0.e7a5.30d2.7" zust:so)
                                                                                                                          [%is q=908.651.950.243.594.834.993.091.554.288.205.831]
                                                                                                                      
                                                                                                                          > (,[%is @is] (scan "af.0.0.0.0.e7a5.30d2.7" zust:so))
                                                                                                                          [%is .af.0.0.0.0.e7a5.30d2.7]
                                                                                                                      
                                                                                                                          > (,[%is @ux] (scan "af.0.0.0.0.e7a5.30d2.7" zust:so))
                                                                                                                          [%is 0xaf.0000.0000.0000.0000.e7a5.30d2.0007]
                                                                                                                      
                                                                                                                          > (scan "y" zust:so)
                                                                                                                          [%f %.y]
                                                                                                                      
                                                                                                                          > (scan "12.09" zust:so)
                                                                                                                          [%rd .~12.00999999999999]

                                                                                                                      <-

                                                                                                                      4k: Atom Printing

                                                                                                                      4m: Formatting Functions

                                                                                                                      ->