Skip to content

How to write Hello World in Hoon and Urbit?

Writing Functions on the REPL

=replsquare |=  a=@ud
^-  @ud
%+  mul
  a
a
(replsquare 12)

The last command should return 144

Writing actual programs and saving them


|mount %base

# Change Files

|commit %base

# Take files off file system

|unmount %base

::  Square a number.
|=  a=@ud
^-  @ud
%+  mul
  a
a
=+  foo=42
|_  =bowl:gall
++  on-init   `..on-init
++  on-save   !>(~)
++  on-load   |=(vase `..on-init)
++  on-poke   |=(cage !!)
++  on-watch  |=(path !!)
++  on-leave  |=(path `..on-init)
++  on-peek   |=(path ~)
++  on-agent  |=([wire sign:agent:gall] !!)
++  on-arvo   |=([wire sign-arvo] !!)
++  on-fail   |=([term tang] `..on-init)
--

|commit %base

=skeleton -build-file %/app/skeleton/hoon

# View Source Code
skeleton
-.skeleton
+.skeleton


=lifecycle -build-file %/app/lifecycle/hoon


=pokeme -build-file %/app/pokeme/hoon
# Start pokeme
|rein %base [& %pokeme]
:pokeme %inc
:pokeme %dec
:pokeme +dbug [%state %val]


=pokeit -build-file %/app/pokeit/hoon
|rein %base [& %pokeme] [& %pokeit]
:pokeit %inc
:pokeit %dec
:pokeme +dbug [%state %val]

Sources