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

                                                                                                                      4c: Tank Printer

                                                                                                                      ++re

                                                                                                                      Pretty-printing engine

                                                                                                                      Pretty-printing engine that accepts a ++tank sample and contains arms that perform computation on it.

                                                                                                                      Accepts

                                                                                                                      tac is a ++tank.

                                                                                                                      Produces

                                                                                                                      ++  re
                                                                                                                            |_  tac/tank
                                                                                                                      

                                                                                                                      Examples

                                                                                                                          > ~(. re leaf+"ham")
                                                                                                                          <2.gdc {tac/{$leaf ""} <402.arm 110.jyx 1.ztu $151>}>

                                                                                                                      ++ram:re

                                                                                                                      Flatten to tape

                                                                                                                      Flatten ++tank out into a ++tape.

                                                                                                                      Accepts

                                                                                                                      tac is a ++tank, taken from sample of ++re core.

                                                                                                                      Produces

                                                                                                                      A ++tape.

                                                                                                                      Source

                                                                                                                      ++  ram
                                                                                                                              ^-  tape
                                                                                                                              ?-    -.tac
                                                                                                                                  $leaf  p.tac
                                                                                                                                  $palm  ram(tac [%rose [p.p.tac (weld q.p.tac r.p.tac) s.p.tac] q.tac])
                                                                                                                                  $rose
                                                                                                                                %+  weld
                                                                                                                                  q.p.tac
                                                                                                                                |-  ^-  tape
                                                                                                                                ?~  q.tac
                                                                                                                                  r.p.tac
                                                                                                                                =+  voz=$(q.tac t.q.tac)
                                                                                                                                (weld ram(tac i.q.tac) ?~(t.q.tac voz (weld p.p.tac voz)))
                                                                                                                              ==
                                                                                                                            ::
                                                                                                                      

                                                                                                                      Examples

                                                                                                                          > ~(ram re leaf+"foo")
                                                                                                                          "foo"
                                                                                                                          > ~(ram re rose+["." "(" ")"]^~[leaf+"bar" leaf+"baz" leaf+"bam"])
                                                                                                                          "(bar.baz.bam)"

                                                                                                                      ++win:re

                                                                                                                      Render at indent

                                                                                                                      Render at indent level tab and width edg.

                                                                                                                      Accepts

                                                                                                                      tac is a ++tank, taken from sample of ++re core.

                                                                                                                      tab and edg are atoms.

                                                                                                                      Produces

                                                                                                                      A ++wall (++list of ++tapes).

                                                                                                                      Source

                                                                                                                      ++  win
                                                                                                                              |=  {tab/@ edg/@}
                                                                                                                              =+  lug=`wall`~
                                                                                                                              |^  |-  ^-  wall
                                                                                                                                  ?-    -.tac
                                                                                                                                      $leaf  (rig p.tac)
                                                                                                                                      $palm
                                                                                                                                    ?:  fit
                                                                                                                                      (rig ram)
                                                                                                                                    ?~  q.tac
                                                                                                                                      (rig q.p.tac)
                                                                                                                                    ?~  t.q.tac
                                                                                                                                      (rig(tab (add 2 tab), lug $(tac i.q.tac)) q.p.tac)
                                                                                                                                    =>  .(q.tac `(list tank)`q.tac)
                                                                                                                                    =+  lyn=(mul 2 (lent q.tac))
                                                                                                                                    =+  ^=  qyr
                                                                                                                                        |-  ^-  wall
                                                                                                                                        ?~  q.tac
                                                                                                                                          lug
                                                                                                                                        %=  ^$
                                                                                                                                          tac  i.q.tac
                                                                                                                                          tab  (add tab (sub lyn 2))
                                                                                                                                          lug  $(q.tac t.q.tac, lyn (sub lyn 2))
                                                                                                                                        ==
                                                                                                                                    (wig(lug qyr) q.p.tac)
                                                                                                                                  ::
                                                                                                                      

                                                                                                                      Examples

                                                                                                                          > (~(win re leaf+"samoltekon-lapdok") 0 20)
                                                                                                                          <<"samoltekon-lapdok">>
                                                                                                                      
                                                                                                                          > (~(win re leaf+"samoltekon-lapdok") 0 10)
                                                                                                                          <<"\/samolt\/" "  ekon-l" "  apdok" "\/      \/">>
                                                                                                                      
                                                                                                                          > (~(win re rose+["--" "[" "]"]^~[leaf+"1423" leaf+"2316"]) 0 20)
                                                                                                                          <<"[1423--2316]">>
                                                                                                                      
                                                                                                                          > (~(win re rose+["--" "[" "]"]^~[leaf+"1423" leaf+"2316"]) 0 10)
                                                                                                                          <<"[ 1423" "  2316" "]">>

                                                                                                                      ++din:re

                                                                                                                      XX document

                                                                                                                      Accepts

                                                                                                                      Produces

                                                                                                                      Source

                                                                                                                          ++  din  (mod (add 2 tab) (mul 2 (div edg 3)))

                                                                                                                      ++fit:re

                                                                                                                      Fit on one line test

                                                                                                                      Determine whether tac fits on one line. Internal to ++win

                                                                                                                      Accepts

                                                                                                                      Produces

                                                                                                                      Source

                                                                                                                      ++ fit (lte (lent ram) (sub edg tab))

                                                                                                                      Examples


                                                                                                                      ++rig:re

                                                                                                                      Wrap in \/

                                                                                                                      Wrap ++tape in \/ if it doesn't fit at current indentation. Internal to ++win

                                                                                                                      Accepts

                                                                                                                      tac is a ++tank, taken from sample of ++re core.

                                                                                                                      hom is a ++tape.

                                                                                                                      Produces

                                                                                                                      A ++wall (list of ++tapes).

                                                                                                                      Source

                                                                                                                      ++  rig
                                                                                                                                |=  hom/tape
                                                                                                                                ^-  wall
                                                                                                                                ?:  & ::(lte (lent hom) (sub edg tab))
                                                                                                                                  [(runt [tab ' '] hom) lug]
                                                                                                                                =>  .(tab (add tab 2), edg (sub edg 2))
                                                                                                                                =+  mut=(trim (sub edg tab) hom)
                                                                                                                                :-  (runt [(sub tab 2) ' '] ['\\' '/' (weld p.mut `_hom`['\\' '/' ~])])
                                                                                                                                =>  .(hom q.mut)
                                                                                                                                |-
                                                                                                                                ?~  hom
                                                                                                                                  :-  %+  runt
                                                                                                                                        [(sub tab 2) ' ']
                                                                                                                                      ['\\' '/' (runt [(sub edg tab) ' '] ['\\' '/' ~])]
                                                                                                                                  lug
                                                                                                                                =>  .(mut (trim (sub edg tab) hom))
                                                                                                                                [(runt [tab ' '] p.mut) $(hom q.mut)]
                                                                                                                              ::
                                                                                                                      

                                                                                                                      Examples


                                                                                                                      ++wig:re

                                                                                                                      ++win render tape

                                                                                                                      Render ++tape. Internal to ++win.

                                                                                                                      Accepts

                                                                                                                      tac is a ++tank, taken from sample of ++re core.

                                                                                                                      hom is a ++tape.

                                                                                                                      Produces

                                                                                                                      ++  wig
                                                                                                                                |=  hom/tape
                                                                                                                                ^-  wall
                                                                                                                                ?~  lug
                                                                                                                                  (rig hom)
                                                                                                                                =+  lin=(lent hom)
                                                                                                                                =+  wug=:(add 1 tab lin)
                                                                                                                                ?.  =+  mir=i.lug
                                                                                                                                    |-  ?~  mir
                                                                                                                                          |
                                                                                                                                        ?|(=(0 wug) ?&(=(' ' i.mir) $(mir t.mir, wug (dec wug))))
                                                                                                                                  (rig hom)       :: ^ XX regular form?
                                                                                                                                [(runt [tab ' '] (weld hom `tape`[' ' (slag wug i.lug)])) t.lug]
                                                                                                                              --
                                                                                                                            --
                                                                                                                      

                                                                                                                      ++show

                                                                                                                      ++  show                            ::  XX deprecated, use span
                                                                                                                            |=  vem/*
                                                                                                                            |^  ^-  tank
                                                                                                                                ?:  ?=(@ vem)
                                                                                                                                  [%leaf (mesc (trip vem))]
                                                                                                                                ?-    vem
                                                                                                                                    {s/$~ c/*}
                                                                                                                                  [%leaf '\'' (weld (mesc (tape +.vem)) `tape`['\'' ~])]
                                                                                                                                ::
                                                                                                                                    {s/$a c/@}        [%leaf (mesc (trip c.vem))]
                                                                                                                                    {s/$b c/*}        (shop c.vem |=(a/@ ~(rub at a)))
                                                                                                                                    {s/{$c p/@} c/*}
                                                                                                                                  :+  %palm
                                                                                                                                    [['.' ~] ['-' ~] ~ ~]
                                                                                                                                  [[%leaf (mesc (trip p.s.vem))] $(vem c.vem) ~]
                                                                                                                                ::
                                                                                                                                    {s/$d c/*}        (shop c.vem |=(a/@ ~(rud at a)))
                                                                                                                                    {s/$k c/*}        (tank c.vem)
                                                                                                                                    {s/$h c/*}
                                                                                                                                  :+  %rose
                                                                                                                                    [['/' ~] ['/' ~] ~]
                                                                                                                                  =+  yol=((list @ta) c.vem)
                                                                                                                                  (turn yol |=(a/@ta [%leaf (trip a)]))
                                                                                                                                ::
                                                                                                                                    {s/$l c/*}        (shol c.vem)
                                                                                                                                    {s/$o c/*}
                                                                                                                                  %=    $
                                                                                                                                      vem
                                                                                                                                    :-  [%m '%h:<[%d %d].[%d %d]>']
                                                                                                                                    [-.c.vem +<-.c.vem +<+.c.vem +>-.c.vem +>+.c.vem ~]
                                                                                                                                  ==
                                                                                                                                ::
                                                                                                                                    {s/$p c/*}        (shop c.vem |=(a/@ ~(rup at a)))
                                                                                                                                    {s/$q c/*}        (shop c.vem |=(a/@ ~(r at a)))
                                                                                                                                    {s/$r c/*}        $(vem [[%r ' ' '{' '}'] c.vem])
                                                                                                                                    {s/$t c/*}        (shop c.vem |=(a/@ ~(rt at a)))
                                                                                                                                    {s/$v c/*}        (shop c.vem |=(a/@ ~(ruv at a)))
                                                                                                                                    {s/$x c/*}        (shop c.vem |=(a/@ ~(rux at a)))
                                                                                                                                    {s/{$m p/@} c/*}  (shep p.s.vem c.vem)
                                                                                                                                    {s/{$r p/@} c/*}
                                                                                                                                  $(vem [[%r ' ' (cut 3 [0 1] p.s.vem) (cut 3 [1 1] p.s.vem)] c.vem])
                                                                                                                                ::
                                                                                                                                    {s/{$r p/@ q/@ r/@} c/*}
                                                                                                                                  :+  %rose
                                                                                                                                    :*  p=(mesc (trip p.s.vem))
                                                                                                                                        q=(mesc (trip q.s.vem))
                                                                                                                                        r=(mesc (trip r.s.vem))
                                                                                                                                    ==
                                                                                                                                  |-  ^-  (list tank)
                                                                                                                                  ?@  c.vem
                                                                                                                                    ~
                                                                                                                                  [^$(vem -.c.vem) $(c.vem +.c.vem)]
                                                                                                                                ::
                                                                                                                                    {s/$z c/*}        $(vem [[%r %$ %$ %$] c.vem])
                                                                                                                                    *                 !!
                                                                                                                                ==
                                                                                                                      

                                                                                                                      XX document

                                                                                                                      ++shep

                                                                                                                      ++  shep
                                                                                                                              |=  {fom/@ gar/*}
                                                                                                                              ^-  tank
                                                                                                                              =+  l=(met 3 fom)
                                                                                                                              =+  i=0
                                                                                                                              :-  %leaf
                                                                                                                              |-  ^-  tape
                                                                                                                              ?:  (gte i l)
                                                                                                                                ~
                                                                                                                              =+  c=(cut 3 [i 1] fom)
                                                                                                                              ?.  =(37 c)
                                                                                                                                (weld (mesc [c ~]) $(i +(i)))
                                                                                                                              =+  d=(cut 3 [+(i) 1] fom)
                                                                                                                              ?.  .?(gar)
                                                                                                                                ['\\' '#' $(i (add 2 i))]
                                                                                                                              (weld ~(ram re (show d -.gar)) $(i (add 2 i), gar +.gar))
                                                                                                                            ::
                                                                                                                      

                                                                                                                      XX document

                                                                                                                      ++shop

                                                                                                                      ++  shop
                                                                                                                              |=  {aug/* vel/$-(a/@ tape)}
                                                                                                                              ^-  tank
                                                                                                                              ?:  ?=(@ aug)
                                                                                                                                [%leaf (vel aug)]
                                                                                                                              :+  %rose
                                                                                                                                [[' ' ~] ['[' ~] [']' ~]]
                                                                                                                              =>  .(aug `*`aug)
                                                                                                                              |-  ^-  (list tank)
                                                                                                                              ?:  ?=(@ aug)
                                                                                                                                [^$ ~]
                                                                                                                              [^$(aug -.aug) $(aug +.aug)]
                                                                                                                            ::
                                                                                                                      

                                                                                                                      XX document


                                                                                                                      <-

                                                                                                                      4b: Text Processing

                                                                                                                      4d: Parsing (Tracing)

                                                                                                                      ->