mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-04 13:19:48 +03:00
Merge branch 'master' into klay
Conflicts: urb/urbit.pill urb/zod/arvo/zuse.hoon
This commit is contained in:
commit
537e2695ff
@ -1,4 +1,4 @@
|
||||
::
|
||||
!:
|
||||
:: ames (4a), networking
|
||||
::
|
||||
|= pit=vase
|
||||
@ -435,7 +435,7 @@
|
||||
vix=(bex +((cut 0 [25 2] mag))) :: width of sender
|
||||
tay=(cut 0 [27 5] mag) :: message type
|
||||
==
|
||||
?> =(6 vez)
|
||||
?> =(7 vez)
|
||||
?> =(chk (end 0 20 (mug bod)))
|
||||
:+ [(end 3 wix bod) (cut 3 [wix vix] bod)]
|
||||
(kins tay)
|
||||
@ -455,7 +455,7 @@
|
||||
=+ tay=(ksin q.kec)
|
||||
%+ mix
|
||||
%+ can 0
|
||||
:~ [3 6]
|
||||
:~ [3 7]
|
||||
[20 (mug bod)]
|
||||
[2 yax]
|
||||
[2 qax]
|
||||
@ -1043,7 +1043,7 @@
|
||||
++ gnaw :: gnaw:am
|
||||
|= [kay=cape ryn=lane pac=rock] :: process packet
|
||||
^- [p=(list boon) q=fort]
|
||||
?. =(6 (end 0 3 pac)) [~ fox]
|
||||
?. =(7 (end 0 3 pac)) [~ fox]
|
||||
=+ kec=(bite pac)
|
||||
?: (goop p.p.kec) [~ fox]
|
||||
?. (~(has by urb.ton.fox) q.p.kec)
|
||||
|
@ -17,6 +17,7 @@
|
||||
[%logo p=@] :: logout
|
||||
[%note p=@tD q=tank] :: show message
|
||||
[%save p=path q=@] :: write atomic file
|
||||
[%sage p=path q=*] :: write jamnoun
|
||||
[%talk p=tank] :: show on console
|
||||
[%tell p=(list ,@t)] :: dump lines
|
||||
[%veer p=@ta q=path r=@t] :: install vane
|
||||
|
@ -1,4 +1,4 @@
|
||||
::
|
||||
!:
|
||||
:: clay (4c), revision control
|
||||
::
|
||||
!:
|
||||
|
@ -1,4 +1,4 @@
|
||||
::
|
||||
!:
|
||||
:: dill (4d), terminal handling
|
||||
::
|
||||
|= pit=vase
|
||||
@ -51,6 +51,7 @@
|
||||
[%helo p=path q=prod] ::
|
||||
[%logo p=@] ::
|
||||
[%save p=path q=@] ::
|
||||
[%sage p=path q=*] ::
|
||||
[%talk p=tank] ::
|
||||
[%tell p=(list ,@t)] ::
|
||||
[%text p=tape] ::
|
||||
@ -97,6 +98,7 @@
|
||||
[%hop p=@ud] :: set cursor position
|
||||
[%lin p=(list ,@c)] :: set current line
|
||||
[%mor ~] :: newline
|
||||
[%sag p=path q=*] :: save to jamfile
|
||||
[%sav p=path q=@] :: save to file
|
||||
== ::
|
||||
++ blot :: kill ring
|
||||
@ -296,6 +298,11 @@
|
||||
+>.$(mos :_(mos [hen %pass ~ %b +.sih]))
|
||||
::
|
||||
%note ?.(p.yar +>.$ (fume p.+.sih q.+.sih)) :: debug message
|
||||
%sage :: write a jamfile
|
||||
%= +>.$
|
||||
mos :_(mos [hen [%give %blit [%sag p.+.sih q.+.sih] ~]])
|
||||
==
|
||||
::
|
||||
%save :: write a file
|
||||
%= +>.$
|
||||
mos :_(mos [hen [%give %blit [%sav p.+.sih q.+.sih] ~]])
|
||||
|
@ -1,4 +1,4 @@
|
||||
:: :: %eyre, http servant
|
||||
!: :: %eyre, http servant
|
||||
!? 164
|
||||
::::
|
||||
|= pit=vase
|
||||
|
@ -1,4 +1,4 @@
|
||||
::::::
|
||||
!:::::
|
||||
:: :: %ford, new execution control
|
||||
!? 164
|
||||
::::
|
||||
@ -19,7 +19,7 @@
|
||||
== ::
|
||||
++ hood :: assembly plan
|
||||
$: zus=@ud :: zuse kelvin
|
||||
str=(list hoof) :: structures
|
||||
sur=(list hoof) :: structures
|
||||
lib=(list hoof) :: libraries
|
||||
fan=(list horn) :: resources
|
||||
src=(list hoop) :: program
|
||||
@ -40,7 +40,7 @@
|
||||
[%man p=(map term horn)] :: /* map by hand
|
||||
[%nap p=horn] :: /% map by @tas
|
||||
[%now p=horn] :: /& map by @da
|
||||
[%saw p=twig q=horn] :: /_ operate on
|
||||
[%saw p=twig q=horn] :: /_ operate on /;
|
||||
[%see p=beam q=horn] :: /. relative to
|
||||
[%sic p=tile q=horn] :: /^ cast
|
||||
[%toy p=mark] :: /mark/ static
|
||||
@ -114,7 +114,6 @@
|
||||
++ calx :: concrete cache line
|
||||
$% [%hood p=calm q=(pair beam cage) r=hood] :: compile
|
||||
[%slap p=calm q=[p=vase q=twig] r=vase] :: compute
|
||||
[%twig p=calm q=cage r=twig] :: compile to twig
|
||||
== ::
|
||||
++ task :: problem in progress
|
||||
$: nah=duct :: cause
|
||||
@ -128,7 +127,6 @@
|
||||
|= cax=calx
|
||||
?+ sem !!
|
||||
%hood ?>(?=(%hood -.cax) r.cax)
|
||||
%twig ?>(?=(%twig -.cax) r.cax)
|
||||
%slap ?>(?=(%slap -.cax) r.cax)
|
||||
==
|
||||
::
|
||||
@ -944,7 +942,7 @@
|
||||
%+ cope (neck cof lib.hyd)
|
||||
|= [cof=cafe sel=_..apex]
|
||||
=. ..apex sel(boy boy)
|
||||
%+ cope (head cof str.hyd)
|
||||
%+ cope (head cof sur.hyd)
|
||||
|= [cof=cafe sel=_..apex]
|
||||
(fine cof sel)
|
||||
::
|
||||
@ -1059,7 +1057,7 @@
|
||||
?. =(`hoof`i.bir `hoof`p.u.byf)
|
||||
(flaw cof [%leaf "structure mismatch: {<~[p.u.byf i.bir]>}"]~)
|
||||
$(bir t.bir)
|
||||
=+ bem=(hone %gate %str i.bir)
|
||||
=+ bem=(hone %gate %sur i.bir)
|
||||
%+ cope (fade cof bem)
|
||||
|= [cof=cafe hyd=hood]
|
||||
%+ cope (apex(boy ~) cof hyd)
|
||||
@ -1068,7 +1066,9 @@
|
||||
%= sel
|
||||
boy boy
|
||||
zeg zeg
|
||||
rop (~(put by rop) p.i.bir [i.bir [%tssg (flop boy.sel)]])
|
||||
rop %+ ~(put by (~(uni by rop) rop.sel))
|
||||
p.i.bir
|
||||
[i.bir [%tssg (flop boy.sel)]]
|
||||
==
|
||||
^^$(cof cof, bir t.bir)
|
||||
::
|
||||
|
@ -9590,7 +9590,7 @@
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: section 3bE, Arvo core ::
|
||||
::
|
||||
++ vent :: vane core
|
||||
++ vent !: :: vane core
|
||||
|= [lal=@tas vil=vile bud=vase ves=vase]
|
||||
|%
|
||||
++ ruck :: update vase
|
||||
@ -9907,6 +9907,7 @@
|
||||
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:::::: :::::: Postface ::::::
|
||||
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
!:
|
||||
=+ pit=`vase`!>(.) ::
|
||||
=+ bud=pit :: becomes tang
|
||||
=+ vil=(viol p.bud) :: cached reflexives
|
||||
|
301
arvo/zuse.hoon
301
arvo/zuse.hoon
@ -1,7 +1,6 @@
|
||||
::
|
||||
:: zuse (3), standard library (tang)
|
||||
::
|
||||
!:
|
||||
|%
|
||||
:::::::::::::::::::::::::::::::::::::::::::::::::::::: ::
|
||||
:::: chapter 3b, Arvo libraries ::::
|
||||
@ -2219,70 +2218,252 @@
|
||||
::
|
||||
++ glam
|
||||
|= zar=@p ^- tape
|
||||
"Mysterious Carrier"
|
||||
:: %+ snag zar
|
||||
:: ^- (list tape)
|
||||
:: :~ "Tianming" "Pepin the Short" "Haile Selassie" "Alfred the Great"
|
||||
:: "Tamerlane" "Pericles" "Talleyrand" "Yongle" "Seleucus"
|
||||
:: "Uther Pendragon" "Louis XVI" "Ahmad Shāh Durrānī" "Constantine"
|
||||
:: "Wilhelm I" "Akbar" "Louis XIV" "Nobunaga" "Alexander VI"
|
||||
:: "Philippe II" "Julius II" "David" "Niall Noígíallach" "Kublai Khan"
|
||||
:: "Öz Beg Khan" "Ozymandias" "Ögedei Khan" "Jiang Jieshi" "Darius"
|
||||
:: "Shivaji" "Qianlong" "Bolesław I Chrobry" "Tigranes" "Han Wudi"
|
||||
:: "Charles X" "Naresuan" "Frederick II" "Simeon" "Kangxi"
|
||||
:: "Suleiman the Magnificent" "Pedro II" "Genghis Khan" "Laozi"
|
||||
:: "Porfirio Díaz" "Pakal" "Wu Zetian" "Garibaldi" "Matthias Corvinus"
|
||||
:: "Leopold II" "Leonidas" "Sitting Bull" "Nebuchadnezzar II"
|
||||
:: "Rhodes" "Henry VIII" "Attila" "Catherine II" "Chulalongkorn"
|
||||
:: "Uthmān" "Augustus" "Faustin" "Chongde" "Justinian"
|
||||
:: "Afonso de Albuquerque" "Antoninus Pius" "Cromwell" "Innocent X"
|
||||
:: "Fidel" "Frederick the Great" "Canute" "Vytautas" "Amina"
|
||||
:: "Hammurabi" "Suharto" "Victoria" "Hiawatha" "Paul V" "Shaka"
|
||||
:: "Lê Thánh Tông" "Ivan Asen II" "Tiridates" "Nefertiti" "Gwangmu"
|
||||
:: "Ferdinand & Isabella" "Askia" "Xuande" "Boris Godunov" "Gilgamesh"
|
||||
:: "Maximillian I" "Mao" "Charlemagne" "Narai" "Hanno" "Charles I & V"
|
||||
:: "Alexander II" "Mansa Musa" "Zoe Porphyrogenita" "Metternich"
|
||||
:: "Robert the Bruce" "Pachacutec" "Jefferson" "Solomon" "Nicholas I"
|
||||
:: "Barbarossa" "FDR" "Pius X" "Gwanggaeto" "Abbas I" "Julius Caesar"
|
||||
:: "Lee Kuan Yew" "Ranavalona I" "Go-Daigo" "Zenobia" "Henry V"
|
||||
:: "Bảo Đại" "Casimir III" "Cyrus" "Charles the Wise" "Sandrokottos"
|
||||
:: "Agamemnon" "Clement VII" "Suppiluliuma" "Deng Xiaoping"
|
||||
:: "Victor Emmanuel" "Ajatasatru" "Jan Sobieski" "Huangdi" "Xuantong"
|
||||
:: "Narmer" "Cosimo de' Medici" "Möngke Khan" "Stephen Dušan" "Henri IV"
|
||||
:: "Mehmed Fatih" "Conn Cétchathach" "Francisco Franco" "Leo X"
|
||||
:: "Kammu" "Krishnadevaraya" "Elizabeth I" "Norton I" "Washington"
|
||||
:: "Meiji" "Umar" "TR" "Peter the Great" "Agustin I" "Ashoka"
|
||||
:: "William the Conqueror" "Kongolo Mwamba" "Song Taizu"
|
||||
:: "Ivan the Terrible" "Yao" "Vercingetorix" "Geronimo" "Rurik"
|
||||
:: "Urban VIII" "Alexios Komnenos" "Maria I" "Tamar" "Bismarck"
|
||||
:: "Arthur" "Jimmu" "Gustavus Adolphus" "Suiko" "Basil I" "Montezuma"
|
||||
:: "Santa Anna" "Xerxes" "Beyazıt Yıldırım" "Samudragupta" "James I"
|
||||
:: "George III" "Kamehameha" "Francesco Sforza" "Trajan"
|
||||
:: "Rajendra Chola" "Hideyoshi" "Cleopatra" "Alexander"
|
||||
:: "Ashurbanipal" "Paul III" "Vespasian" "Tecumseh" "Narasimhavarman"
|
||||
:: "Suryavarman II" "Bokassa I" "Charles Canning" "Theodosius"
|
||||
:: "Francis II" "Zhou Wen" "William Jardine" "Ahmad al-Mansur"
|
||||
:: "Lajos Nagy" "Theodora" "Mussolini" "Samuil" "Osman Gazi"
|
||||
:: "Kim Il-sung" "Maria Theresa" "Lenin" "Tokugawa" "Marcus Aurelius"
|
||||
:: "Nzinga Mbande" "Edward III" "Joseph II" "Pulakesi II" "Priam"
|
||||
:: "Qin Shi Huang" "Shah Jahan" "Sejong" "Sui Wendi" "Otto I"
|
||||
:: "Napoleon III" "Prester John" "Dido" "Joao I" "Gregory I"
|
||||
:: "Gajah Mada" "Abd-ar Rahmān III" "Taizong" "Franz Josef I"
|
||||
:: "Nicholas II" "Gandhi" "Chandragupta II" "Peter III"
|
||||
:: "Oba Ewuare" "Louis IX" "Napoleon" "Selim Yavuz" "Shun"
|
||||
:: "Hayam Wuruk" "Jagiełło" "Nicaule" "Sargon" "Saladin" "Charles II"
|
||||
:: "Brian Boru" "Da Yu" "Antiochus III" "Charles I"
|
||||
:: "Jan Pieterszoon Coen" "Hongwu" "Mithridates" "Hadrian" "Ptolemy"
|
||||
:: "Benito Juarez" "Sun Yat-sen" "Raja Raja Chola" "Bolivar" "Pius VII"
|
||||
:: "Shapur II" "Taksin" "Ram Khamhaeng" "Hatshepsut" "Alī" "Matilda"
|
||||
:: "Ataturk"
|
||||
:: ==
|
||||
%+ snag zar
|
||||
^- (list tape)
|
||||
:~ "Tianming" "Pepin the Short" "Haile Selassie" "Alfred the Great"
|
||||
"Tamerlane" "Pericles" "Talleyrand" "Yongle" "Seleucus"
|
||||
"Uther Pendragon" "Louis XVI" "Ahmad Shāh Durrānī" "Constantine"
|
||||
"Wilhelm I" "Akbar" "Louis XIV" "Nobunaga" "Alexander VI"
|
||||
"Philippe II" "Julius II" "David" "Niall Noígíallach" "Kublai Khan"
|
||||
"Öz Beg Khan" "Ozymandias" "Ögedei Khan" "Jiang Jieshi" "Darius"
|
||||
"Shivaji" "Qianlong" "Bolesław I Chrobry" "Tigranes" "Han Wudi"
|
||||
"Charles X" "Naresuan" "Frederick II" "Simeon" "Kangxi"
|
||||
"Suleiman the Magnificent" "Pedro II" "Genghis Khan" "Laozi"
|
||||
"Porfirio Díaz" "Pakal" "Wu Zetian" "Garibaldi" "Matthias Corvinus"
|
||||
"Leopold II" "Leonidas" "Sitting Bull" "Nebuchadnezzar II"
|
||||
"Rhodes" "Henry VIII" "Attila" "Catherine II" "Chulalongkorn"
|
||||
"Uthmān" "Augustus" "Faustin" "Chongde" "Justinian"
|
||||
"Afonso de Albuquerque" "Antoninus Pius" "Cromwell" "Innocent X"
|
||||
"Fidel" "Frederick the Great" "Canute" "Vytautas" "Amina"
|
||||
"Hammurabi" "Suharto" "Victoria" "Hiawatha" "Paul V" "Shaka"
|
||||
"Lê Thánh Tông" "Ivan Asen II" "Tiridates" "Nefertiti" "Gwangmu"
|
||||
"Ferdinand & Isabella" "Askia" "Xuande" "Boris Godunov" "Gilgamesh"
|
||||
"Maximillian I" "Mao" "Charlemagne" "Narai" "Hanno" "Charles I & V"
|
||||
"Alexander II" "Mansa Musa" "Zoe Porphyrogenita" "Metternich"
|
||||
"Robert the Bruce" "Pachacutec" "Jefferson" "Solomon" "Nicholas I"
|
||||
"Barbarossa" "FDR" "Pius X" "Gwanggaeto" "Abbas I" "Julius Caesar"
|
||||
"Lee Kuan Yew" "Ranavalona I" "Go-Daigo" "Zenobia" "Henry V"
|
||||
"Bảo Đại" "Casimir III" "Cyrus" "Charles the Wise" "Sandrokottos"
|
||||
"Agamemnon" "Clement VII" "Suppiluliuma" "Deng Xiaoping"
|
||||
"Victor Emmanuel" "Ajatasatru" "Jan Sobieski" "Huangdi" "Xuantong"
|
||||
"Narmer" "Cosimo de' Medici" "Möngke Khan" "Stephen Dušan" "Henri IV"
|
||||
"Mehmed Fatih" "Conn Cétchathach" "Francisco Franco" "Leo X"
|
||||
"Kammu" "Krishnadevaraya" "Elizabeth I" "Norton I" "Washington"
|
||||
"Meiji" "Umar" "TR" "Peter the Great" "Agustin I" "Ashoka"
|
||||
"William the Conqueror" "Kongolo Mwamba" "Song Taizu"
|
||||
"Ivan the Terrible" "Yao" "Vercingetorix" "Geronimo" "Rurik"
|
||||
"Urban VIII" "Alexios Komnenos" "Maria I" "Tamar" "Bismarck"
|
||||
"Arthur" "Jimmu" "Gustavus Adolphus" "Suiko" "Basil I" "Montezuma"
|
||||
"Santa Anna" "Xerxes" "Beyazıt Yıldırım" "Samudragupta" "James I"
|
||||
"George III" "Kamehameha" "Francesco Sforza" "Trajan"
|
||||
"Rajendra Chola" "Hideyoshi" "Cleopatra" "Alexander"
|
||||
"Ashurbanipal" "Paul III" "Vespasian" "Tecumseh" "Narasimhavarman"
|
||||
"Suryavarman II" "Bokassa I" "Charles Canning" "Theodosius"
|
||||
"Francis II" "Zhou Wen" "William Jardine" "Ahmad al-Mansur"
|
||||
"Lajos Nagy" "Theodora" "Mussolini" "Samuil" "Osman Gazi"
|
||||
"Kim Il-sung" "Maria Theresa" "Lenin" "Tokugawa" "Marcus Aurelius"
|
||||
"Nzinga Mbande" "Edward III" "Joseph II" "Pulakesi II" "Priam"
|
||||
"Qin Shi Huang" "Shah Jahan" "Sejong" "Sui Wendi" "Otto I"
|
||||
"Napoleon III" "Prester John" "Dido" "Joao I" "Gregory I"
|
||||
"Gajah Mada" "Abd-ar Rahmān III" "Taizong" "Franz Josef I"
|
||||
"Nicholas II" "Gandhi" "Chandragupta II" "Peter III"
|
||||
"Oba Ewuare" "Louis IX" "Napoleon" "Selim Yavuz" "Shun"
|
||||
"Hayam Wuruk" "Jagiełło" "Nicaule" "Sargon" "Saladin" "Charles II"
|
||||
"Brian Boru" "Da Yu" "Antiochus III" "Charles I"
|
||||
"Jan Pieterszoon Coen" "Hongwu" "Mithridates" "Hadrian" "Ptolemy"
|
||||
"Benito Juarez" "Sun Yat-sen" "Raja Raja Chola" "Bolivar" "Pius VII"
|
||||
"Shapur II" "Taksin" "Ram Khamhaeng" "Hatshepsut" "Alī" "Matilda"
|
||||
"Ataturk"
|
||||
==
|
||||
::
|
||||
++ glon
|
||||
|= lag=lang
|
||||
^- (unit tape)
|
||||
?+ lag ~
|
||||
%en [~ "English"] :: deleted others, memory crunch!
|
||||
%aa [~ "Afar"]
|
||||
%ab [~ "Abkhazian"]
|
||||
%ae [~ "Avestan"]
|
||||
%af [~ "Afrikaans"]
|
||||
%ak [~ "Akan"]
|
||||
%am [~ "Amharic"]
|
||||
%an [~ "Aragonese"]
|
||||
%ar [~ "Arabic"]
|
||||
%as [~ "Assamese"]
|
||||
%av [~ "Avaric"]
|
||||
%ay [~ "Aymara"]
|
||||
%az [~ "Azerbaijani"]
|
||||
%ba [~ "Bashkir"]
|
||||
%be [~ "Belarusian"]
|
||||
%bg [~ "Bulgarian"]
|
||||
%bh [~ "Bihari"]
|
||||
%bi [~ "Bislama"]
|
||||
%bm [~ "Bambara"]
|
||||
%bn [~ "Bengali"]
|
||||
%bo [~ "Tibetan"]
|
||||
%br [~ "Breton"]
|
||||
%bs [~ "Bosnian"]
|
||||
%ca [~ "Catalan"]
|
||||
%ce [~ "Chechen"]
|
||||
%ch [~ "Chamorro"]
|
||||
%co [~ "Corsican"]
|
||||
%cr [~ "Cree"]
|
||||
%cs [~ "Czech"]
|
||||
%cu [~ "Slavonic"]
|
||||
%cv [~ "Chuvash"]
|
||||
%cy [~ "Welsh"]
|
||||
%da [~ "Danish"]
|
||||
%de [~ "German"]
|
||||
%dv [~ "Maldivian"]
|
||||
%dz [~ "Dzongkha"]
|
||||
%ee [~ "Ewe"]
|
||||
%el [~ "Greek"]
|
||||
%en [~ "English"]
|
||||
%eo [~ "Esperanto"]
|
||||
%es [~ "Spanish"]
|
||||
%et [~ "Estonian"]
|
||||
%eu [~ "Basque"]
|
||||
%fa [~ "Persian"]
|
||||
%ff [~ "Fulah"]
|
||||
%fi [~ "Finnish"]
|
||||
%fj [~ "Fijian"]
|
||||
%fo [~ "Faroese"]
|
||||
%fr [~ "French"]
|
||||
%fy [~ "Frisian"]
|
||||
%ga [~ "Irish Gaelic"]
|
||||
%gd [~ "Scottish Gaelic"]
|
||||
%gl [~ "Galician"]
|
||||
%gn [~ "Guarani"]
|
||||
%gu [~ "Gujarati"]
|
||||
%gv [~ "Manx"]
|
||||
%ha [~ "Hausa"]
|
||||
%he [~ "Hebrew"]
|
||||
%hi [~ "Hindi"]
|
||||
%ho [~ "Hiri Motu"]
|
||||
%hr [~ "Croatian"]
|
||||
%ht [~ "Haitian Creole"]
|
||||
%hu [~ "Hungarian"]
|
||||
%hy [~ "Armenian"]
|
||||
%hz [~ "Herero"]
|
||||
%ia [~ "Interlingua"]
|
||||
%id [~ "Indonesian"]
|
||||
%ie [~ "Occidental"]
|
||||
%ig [~ "Igbo"]
|
||||
%ii [~ "Nuosu"]
|
||||
%ik [~ "Inupiaq"]
|
||||
%io [~ "Ido"]
|
||||
%is [~ "Icelandic"]
|
||||
%it [~ "Italian"]
|
||||
%iu [~ "Inuktitut"]
|
||||
%ja [~ "Japanese"]
|
||||
%jv [~ "Javanese"]
|
||||
%ka [~ "Georgian"]
|
||||
%kg [~ "Kongo"]
|
||||
%ki [~ "Kikuyu"]
|
||||
%kj [~ "Kwanyama"]
|
||||
%kk [~ "Kazakh"]
|
||||
%kl [~ "Kalaallisut"]
|
||||
%km [~ "Central Khmer"]
|
||||
%kn [~ "Kannada"]
|
||||
%ko [~ "Korean"]
|
||||
%kr [~ "Kanuri"]
|
||||
%ks [~ "Kashmiri"]
|
||||
%ku [~ "Kurdish"]
|
||||
%kv [~ "Komi"]
|
||||
%kw [~ "Cornish"]
|
||||
%ky [~ "Kyrgyz"]
|
||||
%la [~ "Latin"]
|
||||
%lb [~ "Luxembourgish"]
|
||||
%lg [~ "Ganda"]
|
||||
%li [~ "Limburgish"]
|
||||
%ln [~ "Lingala"]
|
||||
%lo [~ "Lao"]
|
||||
%lt [~ "Lithuanian"]
|
||||
%lu [~ "Luba-Katanga"]
|
||||
%lv [~ "Latvian"]
|
||||
%mg [~ "Malagasy"]
|
||||
%mh [~ "Marshallese"]
|
||||
%mi [~ "Maori"]
|
||||
%mk [~ "Macedonian"]
|
||||
%ml [~ "Malayalam"]
|
||||
%mn [~ "Mongolian"]
|
||||
%mr [~ "Marathi"]
|
||||
%ms [~ "Malay"]
|
||||
%mt [~ "Maltese"]
|
||||
%my [~ "Burmese"]
|
||||
%na [~ "Nauru"]
|
||||
%nb [~ "Norwegian Bokmål"]
|
||||
%nd [~ "North Ndebele"]
|
||||
%ne [~ "Nepali"]
|
||||
%ng [~ "Ndonga"]
|
||||
%nl [~ "Dutch"]
|
||||
%nn [~ "Norwegian Nynorsk"]
|
||||
%no [~ "Norwegian"]
|
||||
%nr [~ "South Ndebele"]
|
||||
%nv [~ "Navajo"]
|
||||
%ny [~ "Chichewa"]
|
||||
%oc [~ "Occitan"]
|
||||
%oj [~ "Ojibwa"]
|
||||
%om [~ "Oromo"]
|
||||
%or [~ "Oriya"]
|
||||
%os [~ "Ossetian"]
|
||||
%pa [~ "Punjabi"]
|
||||
%pi [~ "Pali"]
|
||||
%pl [~ "Polish"]
|
||||
%ps [~ "Pashto"]
|
||||
%pt [~ "Portuguese"]
|
||||
%qu [~ "Quechua"]
|
||||
%rm [~ "Romansh"]
|
||||
%rn [~ "Rundi"]
|
||||
%ro [~ "Romanian"]
|
||||
%ru [~ "Russian"]
|
||||
%rw [~ "Kinyarwanda"]
|
||||
%sa [~ "Sanskrit"]
|
||||
%sc [~ "Sardinian"]
|
||||
%sd [~ "Sindhi"]
|
||||
%se [~ "Northern Sami"]
|
||||
%sg [~ "Sango"]
|
||||
%si [~ "Sinhala"]
|
||||
%sk [~ "Slovak"]
|
||||
%sl [~ "Slovenian"]
|
||||
%sm [~ "Samoan"]
|
||||
%sn [~ "Shona"]
|
||||
%so [~ "Somali"]
|
||||
%sq [~ "Albanian"]
|
||||
%sr [~ "Serbian"]
|
||||
%ss [~ "Swati"]
|
||||
%st [~ "Sotho"]
|
||||
%su [~ "Sundanese"]
|
||||
%sv [~ "Swedish"]
|
||||
%sw [~ "Swahili"]
|
||||
%ta [~ "Tamil"]
|
||||
%te [~ "Telugu"]
|
||||
%tg [~ "Tajik"]
|
||||
%th [~ "Thai"]
|
||||
%ti [~ "Tigrinya"]
|
||||
%tk [~ "Turkmen"]
|
||||
%tl [~ "Tagalog"]
|
||||
%tn [~ "Tswana"]
|
||||
%to [~ "Tonga"]
|
||||
%tr [~ "Turkish"]
|
||||
%ts [~ "Tsonga"]
|
||||
%tt [~ "Tatar"]
|
||||
%tw [~ "Twi"]
|
||||
%ty [~ "Tahitian"]
|
||||
%ug [~ "Uighur"]
|
||||
%uk [~ "Ukrainian"]
|
||||
%ur [~ "Urdu"]
|
||||
%uz [~ "Uzbek"]
|
||||
%ve [~ "Venda"]
|
||||
%vi [~ "Vietnamese"]
|
||||
%vo [~ "Volapük"]
|
||||
%wa [~ "Walloon"]
|
||||
%wo [~ "Wolof"]
|
||||
%xh [~ "Xhosa"]
|
||||
%yi [~ "Yiddish"]
|
||||
%yo [~ "Yoruba"]
|
||||
%za [~ "Zhuang"]
|
||||
%zh [~ "Chinese"]
|
||||
%zu [~ "Zulu"]
|
||||
==
|
||||
::
|
||||
++ gnow
|
||||
|
@ -1,16 +1,10 @@
|
||||
!:
|
||||
:: /=main=/toy/cat/hoon
|
||||
:: /=main=/bin/cat/hoon
|
||||
::
|
||||
|= *
|
||||
|= ape=(list path)
|
||||
:_ ~
|
||||
:_ ~
|
||||
^- gift
|
||||
:- %te
|
||||
=- |- ^- (list ,@t)
|
||||
?~(foz ~ (weld i.foz $(foz t.foz)))
|
||||
^= foz
|
||||
=| foz=(list (list ,@t))
|
||||
|- ^+ foz
|
||||
?~ ape ~
|
||||
[(lore ((hard ,@) .^(%cx i.ape))) $(ape t.ape)]
|
||||
=- ~[-]~
|
||||
^- gift :- %te
|
||||
%- zing
|
||||
%+ turn ape |= pax=path
|
||||
(lore ;;(,@t .^(%cx pax)))
|
||||
|
@ -38,7 +38,8 @@
|
||||
=+ nex=+:.*([-.gat [sam +>.gat]] -.gat)
|
||||
$(vay t.vay, all nex)
|
||||
:_ ~ :_ ~
|
||||
~& %solid-jamming
|
||||
=+ pac=(jam [ken all])
|
||||
~& %solid-finished
|
||||
[%xx %save [%urbit %pill ~] pac]
|
||||
:: ~& %solid-jamming
|
||||
:: =+ pac=(jam [ken all])
|
||||
:: ~& %solid-finished
|
||||
:: [%xx %save [%urbit %pill ~] pac]
|
||||
[%xx %sage [%urbit %pill ~] [ken all]]
|
||||
|
8780
main/doc/ref/doc-split-me.txt
Normal file
8780
main/doc/ref/doc-split-me.txt
Normal file
File diff suppressed because it is too large
Load Diff
128
main/doc/ref/index.md
Normal file
128
main/doc/ref/index.md
Normal file
@ -0,0 +1,128 @@
|
||||
- Foreward
|
||||
- Nock
|
||||
|
||||
- Preface
|
||||
|
||||
- volume 0, version stub
|
||||
|
||||
- volume 1, Hoon models
|
||||
|
||||
- volume 2, Hoon libraries and compiler
|
||||
|
||||
- chapter 2a, basic unsigned math
|
||||
|
||||
- chapter 2b, basic containers
|
||||
|
||||
- section 2bA, units
|
||||
- section 2bB, lists
|
||||
|
||||
- chapter 2c, simple noun surgery
|
||||
|
||||
### Chapters 2a through 2eZ refactoring and second-pass.
|
||||
### Dulin and Henry.
|
||||
|
||||
- section 2cA, bit surgery
|
||||
- section 2cB, bit logic
|
||||
- section 2cC, noun orders
|
||||
- section 2cD, insecure hashing
|
||||
- section 2cE, phonetic base
|
||||
- section 2cF, signed and modular ints
|
||||
- section 2cG, floating point
|
||||
- section 2cH, urbit time
|
||||
- section 2cI, almost macros
|
||||
|
||||
- chapter 2d, containers
|
||||
|
||||
- section 2dA, sets
|
||||
- section 2dB, maps
|
||||
- section 2dC, queues
|
||||
- section 2dD, casual containers
|
||||
|
||||
- chapter 2e, miscellaneous libs
|
||||
|
||||
### Anton - virtualization
|
||||
|
||||
- section 2eA, packing
|
||||
- section 2eB, parsing (tracing)
|
||||
- section 2eC, parsing (custom rules)
|
||||
- section 2eD, parsing (combinators)
|
||||
- section 2eE, parsing (composers)
|
||||
- section 2eF, parsing (ascii)
|
||||
- section 2eG, parsing (whitespace)
|
||||
- section 2eH, parsing (idioms)
|
||||
- section 2eI, parsing (external)
|
||||
- section 2eJ, formatting (basic text)
|
||||
- section 2eK, formatting (layout)
|
||||
- section 2eL, formatting (path)
|
||||
- section 2eM, regular expressions
|
||||
- section 2eN, psuedo-cryptography
|
||||
- section 2eO, virtualization
|
||||
- section 2eP, diff (move me)
|
||||
- section 2eW, lite number theory
|
||||
- section 2eX, jetted crypto (move)
|
||||
- section 2eY, SHA-2564 (move me)
|
||||
- section 2eZ, OLD rendering (kill me)
|
||||
|
||||
### Chapter 2f is Philip.
|
||||
|
||||
- chapter 2f, Hoon proper
|
||||
|
||||
- section 2fA, miscellaneous funs
|
||||
- section 2fB, macro expansion
|
||||
- section 2fC, compilation proper
|
||||
- section 2fD, grammar
|
||||
|
||||
- volume 3, Arvo models and skeleton
|
||||
|
||||
- chapter 3a, Arvo core
|
||||
|
||||
- chapter 3b, Arvo libraries, zuse
|
||||
|
||||
### Anton - All of Chapter 3b except 3bE and 3bG.
|
||||
|
||||
- section 3bA, lite number theory
|
||||
- section 3bB, cryptosuites
|
||||
- section 3bC, UTC
|
||||
- section 3bD, JSON and XML
|
||||
- section 3bE, tree sync
|
||||
- section 3bF, names etc
|
||||
- section 3bG, Arvo models
|
||||
|
||||
- Volume 4, Arvo vanes
|
||||
|
||||
### Chapter 4a, %ames, is Philip. Possibly %ford nad %gall as well.
|
||||
|
||||
- chapter 4a, ames, networking
|
||||
|
||||
- section 4aA, structures
|
||||
- section 4aB, identity logic
|
||||
- section 4aC, packet format
|
||||
- section 4aD, PKI engine
|
||||
- section 4aE, packet pump
|
||||
- section 4aF, protocol engine
|
||||
- section 4aG, protocol vane
|
||||
|
||||
- chapter 4b, batz: shell
|
||||
|
||||
- section 4bA, shell models
|
||||
- section 4bB, session engine
|
||||
- section 4bC, shell vane
|
||||
|
||||
- chapter 4c, clay: revision control
|
||||
|
||||
- section 4cA, structures
|
||||
- section 4cB, filesystem logic
|
||||
- section 4cC, filesystem vane
|
||||
|
||||
### Anton Chapter 4d
|
||||
|
||||
- chapter 4d, dill: terminal handling
|
||||
|
||||
- chapter 4e, eyre: http servant
|
||||
|
||||
- chapter 4f, ford: execution control
|
||||
|
||||
- chapter 4g, gall: user-level applications
|
||||
|
||||
- Postface
|
||||
|
618
main/doc/ref/nock.md
Normal file
618
main/doc/ref/nock.md
Normal file
@ -0,0 +1,618 @@
|
||||
Nock Reference
|
||||
==============
|
||||
|
||||
##What is Nock?
|
||||
|
||||
Nock is a homoiconic combinator algebra, not much fancier than SKI combinators.
|
||||
The spec fits on a T-shirt and gzips to 340 bytes.
|
||||
|
||||
Think of Nock as a kind of functional assembly language. It's not like assembly
|
||||
language in that it's directly executed by the hardware. It is like assembly
|
||||
language in that (a) everything in Urbit executes as Nock; (b) you wouldn't want
|
||||
to program directly in Nock; and (c) learning to program directly in Nock is a
|
||||
great way to start understanding Urbit from the ground up.
|
||||
|
||||
Just as Unix runs C programs by compiling them to assembler, Urbit runs Hoon
|
||||
programs by compiling them to Nock. You could try to learn Hoon without learning
|
||||
Nock. But just as C is a thin wrapper over the physical CPU, Hoon is a thin
|
||||
wrapper over the Nock virtual machine. It's a tall stack made of thin layers,
|
||||
which is much easier to learn a layer at a time.
|
||||
|
||||
And unlike most fundamental theories of computing, there's really nothing smart
|
||||
or interesting about Nock. Of course, in a strictly formal sense, all of
|
||||
computing is math. But that doesn't mean it needs to feel like math. Nock is a
|
||||
simple mechanical device and it's meant to feel that way.
|
||||
|
||||
##Nouns
|
||||
|
||||
1 :: A noun is an atom or a cell.
|
||||
2 :: An atom is a natural number.
|
||||
3 :: A cell is an ordered pair of nouns.
|
||||
|
||||
|
||||
An **atom** is a natural number - ie, an unsigned integer. Nock does not limit
|
||||
the size of **atoms**, or know what an **atom** means.
|
||||
|
||||
For instance, the **atom** `97` might mean the number `97`, or it might mean the
|
||||
letter `a` (ASCII 97). A very large **atom** might be the number of grains of
|
||||
sand on the beach - or it might be a GIF of your children playing on the beach.
|
||||
Typically when we represent strings or files as **atoms**, the first byte is the
|
||||
low byte. But even this is just a convention. An **atom** is an **atom**.
|
||||
|
||||
A **cell** is an ordered pair of any two **nouns** - **cell** or **atom**. We
|
||||
group cells with square brackets:
|
||||
|
||||
[1 1]
|
||||
[34 45]
|
||||
[[3 42] 12]
|
||||
[[1 0] [0 [1 99]]]
|
||||
|
||||
*Nouns* are the dumbest data model ever. **Nouns** make JSON look like XML and
|
||||
XML look like ASN.1. It may also remind you of Lisp's S-expressions - you can
|
||||
think of nouns as "S-expressions without the S."
|
||||
|
||||
To be exact, a *noun* is an S-expression, except that classic S-expressions have
|
||||
multiple **atom** types ("S" is for "symbol"). Since Nock is designed to be
|
||||
used with a higher-level type system (such as Hoon's), it does not need
|
||||
low-level types. An **atom** is just an unsigned integer of any size.
|
||||
|
||||
For instance, it's common to represent strings (or even whole text files) as
|
||||
atoms, arranging them LSB first - so "foo" becomes `0x6f6f66`. How do we know to
|
||||
print this as "foo", not `0x6f6f66`? We need external information - such as a
|
||||
Hoon type. Similarly, other common atomic types - signed integers, floating
|
||||
point, etc
|
||||
- are all straightforward to map into **atoms**.
|
||||
|
||||
It's also important to note that, unlike Lisp, Nock cannot create cyclical data
|
||||
structures. It is normal and common for **nouns** in a Nock runtime system to
|
||||
have acyclic structure - shared subtrees. But there is no Nock computation that
|
||||
can make a child point to its parent. One consequence: Nock has no garbage
|
||||
collector. (Nor can dag structure be detected, as with Lisp eq.)
|
||||
|
||||
There is also no single syntax for **nouns**. If you have **nouns** you have
|
||||
Nock; if you have Nock you have Hoon; if you have Hoon, you can write whatever
|
||||
parser you like.
|
||||
|
||||
##The Nock Function
|
||||
|
||||
5 :: nock(a) *a
|
||||
|
||||
Nock is a pure (stateless) function from **noun** to **noun**. In our pseudocode
|
||||
(and only in our pseudocode) we express this with the prefix operator `*`.
|
||||
|
||||
A Nock program is given meaning by a process of reduction. To compute `nock(x)`,
|
||||
where `x` is any **noun**, we step through the rules from the top down, find the
|
||||
first left-hand side that matches `x`, and reduce it to the right-hand side (in
|
||||
more mathematical notation, we might write line 5 as `nock(a) -> *a`, a style we
|
||||
do use in documentation)
|
||||
|
||||
When we use variable names, like `a`, in the pseudocode spec, we simply mean
|
||||
that the rule fits for any **noun** `a`.
|
||||
|
||||
So `nock(x)` is `*x`, for any **noun** `x`. And how do we reduce `*x`? Looking
|
||||
up, we see that lines 23 through 39 reduce `*x` - for different patterns of `x`.
|
||||
|
||||
Normally `a` in `nock(a)` is a **cell** `[s f]`, or
|
||||
|
||||
[subject formula]
|
||||
|
||||
Intuitively, the formula is your function and the subject is its argument.
|
||||
Hoon, or any other high-level language built on Nock, will build its own
|
||||
function calling convention which does not map directly to `*[subject formula]`.
|
||||
|
||||
##Bracket Grouping
|
||||
|
||||
6 :: [a b c] [a [b c]]
|
||||
|
||||
Brackets associate to the right.
|
||||
|
||||
So instead of writing
|
||||
|
||||
[2 [6 7]]
|
||||
[2 [6 [14 15]]]
|
||||
[2 [6 [[28 29] [30 31]]]]
|
||||
[2 [6 [[28 29] [30 [62 63]]]]]
|
||||
|
||||
we can write
|
||||
|
||||
[2 6 7]
|
||||
[2 6 14 15]
|
||||
[2 6 [28 29] 30 31]
|
||||
[2 6 [28 29] 30 62 63]
|
||||
|
||||
While this notational convenience is hardly rocket science, it's surprising how
|
||||
confusing it can be, especially if you have a Lisp background. Lisp's
|
||||
"S-expressions" are very similar to **nouns**, except that Lisp has multiple
|
||||
types of **atom**, and Lisp's syntax automatically adds list terminators to
|
||||
groups.
|
||||
|
||||
For those with Lisp experience, it's important to note that Nock and Hoon use
|
||||
tuples or "improper lists" much more heavily than Lisp. The list terminator,
|
||||
normally 0, is never automatic. So the Lisp list
|
||||
|
||||
(a b c)
|
||||
|
||||
becomes the Nock **noun**
|
||||
|
||||
[a b c 0]
|
||||
|
||||
which is equivalent to
|
||||
|
||||
[a [b [c 0]]]
|
||||
|
||||
Note that we can and do use unnecessary brackets anyway, for emphasis.
|
||||
|
||||
##Axiomatic Functions
|
||||
|
||||
8 :: ?[a b] 0
|
||||
9 :: ?a 1
|
||||
10 :: +[a b] +[a b]
|
||||
11 :: +a 1 + a
|
||||
12 :: =[a a] 0
|
||||
13 :: =[a b] 1
|
||||
|
||||
Here we define three of Nock's four axiomatic functions: **Cell-test**,
|
||||
**Increment** and **Equals** (the fourth axiomatic function, called **Address**,
|
||||
is defined in lines 16 through 21). These functions are just pseudocode, not
|
||||
actual Nock syntax, and are only used to define the behaviour of certain Nock
|
||||
operators.
|
||||
|
||||
We should note that in Nock and Hoon, `0` (pronounced "yes") is true, and `1`
|
||||
("no") is false. This convention is the opposite of old-fashioned booleans, so
|
||||
we try hard to say "yes" and "no" instead of "true" and "false."
|
||||
|
||||
###Cell-test: `?`
|
||||
|
||||
`?` (pronounced "wut") tests whether is a **noun** is a **cell**. Again, `0`
|
||||
means "yes", `1` means "no":
|
||||
|
||||
8 :: ?[a b] 0
|
||||
9 :: ?a 1
|
||||
|
||||
---
|
||||
|
||||
###Increment: `+`
|
||||
|
||||
`+` (pronounced "lus") adds `1` to an **atom**:
|
||||
|
||||
10 :: +[a b] +[a b]
|
||||
11 :: +a 1 + a
|
||||
|
||||
---
|
||||
|
||||
###Equals: `=`
|
||||
|
||||
`=` (pronounced "tis") tests a cell for
|
||||
equality. `0` means "yes", `1` means "no":
|
||||
|
||||
12 :: =[a a] 0
|
||||
13 :: =[a b] 1
|
||||
14 :: =a =a
|
||||
|
||||
Testing an **atom** for equality makes no sense and logically fails to
|
||||
terminate.
|
||||
|
||||
---
|
||||
|
||||
Because `+` works only for **atoms**, whereas `=` works only for **cells**, the
|
||||
error rules match first for `+` and last for `=`.
|
||||
|
||||
|
||||
|
||||
##Noun Address
|
||||
|
||||
16 :: /[1 a] a
|
||||
17 :: /[2 a b] a
|
||||
18 :: /[3 a b] b
|
||||
19 :: /[(a + a) b] /[2 /[a b]]
|
||||
20 :: /[(a + a + 1) b] /[3 /[a b]]
|
||||
21 :: /a /a
|
||||
|
||||
We define a **noun** as a binary tree - where each node branches to a left and
|
||||
right child - and assign an address, or **axis**, to every element in the tree.
|
||||
The root of the tree is `/1`. The left child (**head**) of every node at `/a` is
|
||||
`/2a`; the right child (**tail**) is `/2a+1`. (Writing `(a + a)` is just a
|
||||
clever way to write `2a`, while minimizing the set of pseudocode forms.)
|
||||
|
||||
`1` is the root. The **head** of every **axis** `n` is `2n`; the **tail** is
|
||||
`2n+1`. Thus a simple tree:
|
||||
|
||||
1
|
||||
2 3
|
||||
4 5 6 7
|
||||
14 15
|
||||
|
||||
If the value of every leaf is its tree address, this tree is
|
||||
|
||||
[[4 5] [6 14 15]]
|
||||
|
||||
Let's use the example `[[97 2] [1 42 0]]`. So
|
||||
|
||||
/[1 [97 2] [1 42 0]] -> [[97 2] [1 42 0]]
|
||||
|
||||
because `/1` is the root of the tree, ie, the whole **noun**.
|
||||
|
||||
Its left child (**head**) is `/2` (i.e. `(1 + 1)`):
|
||||
|
||||
/[2 [97 2] [1 42 0]] -> [97 2]
|
||||
|
||||
And its right child (**tail**) is `/3` (i.e. `(1 + 1 + 1)`):
|
||||
|
||||
/[3 [97 2] [1 42 0]] -> [1 42 0]
|
||||
|
||||
And delving into `/3`, we see `/(3 + 3)` and `/(3 + 3 + 1)`:
|
||||
|
||||
/[6 [97 2] [1 42 0]] -> 1
|
||||
/[7 [97 2] [1 42 0]] -> [42 0]
|
||||
|
||||
It's also fun to build nouns in which every atom is its own axis:
|
||||
|
||||
1
|
||||
[2 3]
|
||||
[2 6 7]
|
||||
[[4 5] 6 7]
|
||||
[[4 5] 6 14 15]
|
||||
[[4 5] [12 13] 14 15]
|
||||
[[4 [10 11]] [12 13] 14 15]
|
||||
[[[8 9] [10 11]] [12 13] 14 30 31]
|
||||
|
||||
##Distribution
|
||||
|
||||
23 :: *[a [b c] d] [*[a b c] *[a d]]
|
||||
|
||||
The practical domain of the Nock function is always a **cell**. When `a` is an
|
||||
**atom**, `*a`, or `nock(a)`, is always an error. Conventionally, Nock proper
|
||||
is always a function of a **cell**. The **head** of this **cell** is the
|
||||
**subject**, the **tail** is the **formula**
|
||||
|
||||
[subject formula]
|
||||
|
||||
and the result of passing a **noun** through the Nock function is called the
|
||||
**product**.
|
||||
|
||||
nock([subject formula]) => product
|
||||
|
||||
or
|
||||
|
||||
*[subject formula] => product
|
||||
|
||||
The **subject** is your data and the **formula** is your code. And the
|
||||
**product** is your code's output.
|
||||
|
||||
Notice that `a` in the Nock rules is always the **subject**, except line 39,
|
||||
which is a crash default for malformed **nouns** that do not evaluate.
|
||||
|
||||
A **formula** is always a **cell**. But when we look inside that **cell**, we
|
||||
see two basic kinds of **formulas**:
|
||||
|
||||
[operator operands]
|
||||
[formula-x formula-y]
|
||||
|
||||
An **operator** is always an **atom** (`0` through `10`). A **formula** is
|
||||
always a **cell**. Line 23 distinguishes these forms:
|
||||
|
||||
23 :: *[a [b c] d] [*[a b c] *[a d]]
|
||||
|
||||
If your code contains multiple **formulas**, the **subject** will distribute
|
||||
over those **formulas**.
|
||||
|
||||
In other words, if you have two Nock **formulas** `x` and `y`, a **formula**
|
||||
that computes the pair of them is just the **cell** `[x y]`.
|
||||
|
||||
*[subject [x y]] -> [*[subject x] *[subject y]]
|
||||
|
||||
No **atom** is a valid **formula**, and every **formula** that does not use line
|
||||
23 has an atomic **head**.
|
||||
|
||||
Suppose you have two **formulas** `f` and `g`, each of which computes some
|
||||
function of the **subject** `s`. You can then construct the **formula** `h` as
|
||||
`[f g]`; and `h(s) = [f(s) g(s)]`.
|
||||
|
||||
For example:
|
||||
|
||||
*[[19 42] [0 3] 0 2]
|
||||
|
||||
The **subject** `s` is `[19 42]`. The **formula** `h` is `*[[0 3] 0 2]`.
|
||||
|
||||
*[s h]
|
||||
|
||||
The **head** of `h` is `f`, which is `[0 3]`. The **tail** of `h` is `g`, which
|
||||
is `[0 2]`.
|
||||
|
||||
*[s [f g]]
|
||||
|
||||
by the distribution rule, `*[s [f g]]` is
|
||||
|
||||
[*[s f] *[s g]]
|
||||
|
||||
or
|
||||
|
||||
[*[[19 42] [0 3]] *[[19 42] 0 2]]
|
||||
|
||||
`*[s f]` is `f(s)` and produces `42`. `*[s g]` is `g(s)` and produces 19.
|
||||
|
||||
Since `h(s)` is `[f(s) g(s)]`, `h(s)` is `[42 19]`:
|
||||
|
||||
*[[19 42] [0 3] 0 2] -> [42 19]
|
||||
|
||||
##Operator 0: Axis
|
||||
|
||||
25 :: *[a 0 b] /[b a]
|
||||
|
||||
Operator 0 is Nock's tree address or **axis** operator, using the tree
|
||||
addressing structure defined in lines 16 through 20. `*[a 0 b]` simply returns
|
||||
the value of the part of `a` at **axis** `b`. For any subject `a`, the formula
|
||||
`[0 b]` produces `/[b a]`.
|
||||
|
||||
For example,
|
||||
|
||||
*[[19 42] 0 3] -> /[3 19 42] -> 42.
|
||||
|
||||
##Operator 1: Just
|
||||
|
||||
26 :: *[a 1 b] b
|
||||
|
||||
`1` is the constant, or **Just operator**. It produces its operand `b` without
|
||||
reference to the **subject**.
|
||||
|
||||
For example,
|
||||
|
||||
*[42 1 57] -> 57
|
||||
|
||||
**Operator 1** is named **Just** because it produces "just" its operand.
|
||||
|
||||
##Operator 2: Fire
|
||||
|
||||
27 :: *[a 2 b c] *[*[a b] *[a c]]
|
||||
|
||||
**Operator 2** is the **Fire operator**, which brings us the essential magic of
|
||||
recursion. Given the **formula** `[2 b c]`, `b` is a **formula** for generating
|
||||
a new **subject**; `c` is a **formula** for generating a new **formula**. To
|
||||
compute `*[a 2 b c]`, we evaluate both `b` and `c` against the current
|
||||
**subject** `a`.
|
||||
|
||||
A common use of **Fire** is to evaluate data inside the **subject** as code.
|
||||
|
||||
For example:
|
||||
|
||||
*[[[40 43] [4 0 1]] [2 [0 4] [0 3]]] -> 41
|
||||
|
||||
*[[[40 43] [4 0 1]] [2 [0 5] [0 3]]] -> 44
|
||||
|
||||
**Operator 2** is called **Fire** because it "fires" Nock **formulas** at its
|
||||
(possibly modified) **subject**.
|
||||
|
||||
##Operator 3: Depth
|
||||
|
||||
28 :: *[a 3 b] ?*[a b]
|
||||
|
||||
**Operator 3** applies the **Cell-test** function defined in lines 8 and 9 to
|
||||
the product of `*[a b]`.
|
||||
|
||||
###Cell-test: `?`
|
||||
|
||||
`?` (pronounced "wut") tests whether is a noun is a cell. Again, 0 means yes, 1
|
||||
means no:
|
||||
|
||||
8 :: ?[a b] 0
|
||||
9 :: ?a 1
|
||||
|
||||
---
|
||||
|
||||
**Operator 3** is called **Depth** because it tests the "depth" of a noun.
|
||||
**Cell-test** properly refers to the pseudocode function `?`.
|
||||
|
||||
##Operator 4: Bump
|
||||
|
||||
29 :: *[a 4 b] +*[a b]
|
||||
|
||||
**Operator 4** applies the **Increment** function defined in lines 10 and
|
||||
11 to the product of `*[a b]`.
|
||||
|
||||
###Increment: +
|
||||
|
||||
`+` (pronounced "lus) adds 1 to an **atom**:
|
||||
|
||||
10 :: +[a b] +[a b]
|
||||
11 :: +a 1 + a
|
||||
|
||||
---
|
||||
|
||||
**Operator 4** is called **Bump** because it "bumps" the atomic product `*[a b]`
|
||||
up by 1. **Increment** properly refers to the pseudocode function `+`.
|
||||
|
||||
|
||||
##Operator 5: Same
|
||||
|
||||
30 :: *[a 5 b] =*[a b]
|
||||
|
||||
**Operator 5** applies the Equals function defined in lines 12, 13 and 14 to the
|
||||
product of *[a b].
|
||||
|
||||
###Equals: =
|
||||
|
||||
= (pronounced "tis", or sometimes "is") tests a cell for equality. 0 means yes,
|
||||
1 means no:
|
||||
|
||||
12 :: =[a a] 0
|
||||
13 :: =[a b] 1
|
||||
14 :: =a =a
|
||||
|
||||
Testing an atom for equality makes no sense and logically fails to terminate.
|
||||
|
||||
---
|
||||
|
||||
**Operator 5** is called the **Same** operator, because it tests if the head and
|
||||
tail of the product of `*[a b]` are the same. "Equals" properly refers to the
|
||||
pseudocode function "=".
|
||||
|
||||
##Operator 6: If
|
||||
|
||||
32 :: *[a 6 b c d] *[a 2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b]
|
||||
|
||||
**Operator 6** is a primitive known to every programmer - **If**. Its operands, a
|
||||
**test formula** `b`, a **then formula** `c` and an **else formula** `d`.
|
||||
|
||||
If the **test** `b` applied to the **subject** evaluates to `0` ("yes"),
|
||||
|
||||
*[a b] -> 0
|
||||
|
||||
then **If** produces the result of `c`, the **then formula**, applied to
|
||||
the **subject**,
|
||||
|
||||
*[a c]
|
||||
|
||||
Else, if applying the **test** to the **subject** produces `1` ("no"),
|
||||
|
||||
*[a b] -> 1
|
||||
|
||||
**Operator 6** produces the result of `d`, the **else formula**, applied to the
|
||||
**subject**,
|
||||
|
||||
*[a d]
|
||||
|
||||
If `*[a b]` produces any value other than `0` ("yes") or `1` ("no"), **If**
|
||||
crashes.
|
||||
|
||||
Let's examine the internals of **Operator 6**:
|
||||
|
||||
**If** could have been defined as a built-in pseudocode function, like
|
||||
**Increment**:
|
||||
|
||||
:: $[0 b c] b
|
||||
:: $[1 b c] c
|
||||
|
||||
Then **Operator 6** could have been restated quite compactly:
|
||||
|
||||
:: *[a 6 b c d] *[a $[*[a b] c d]]
|
||||
|
||||
However, this is unnecessary complexity. **If** can be written as a macro using the
|
||||
primitive operators:
|
||||
|
||||
32 :: *[a 6 b c d] *[a 2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b]
|
||||
|
||||
Reducing the right-hand side (an excellent exercise for the reader) produces:
|
||||
|
||||
*[a *[[c d] [0 *[[2 3] [0 ++*[a b]]]]]]
|
||||
|
||||
Which is the reduced pseudocode form of **Operator 6**.
|
||||
|
||||
Additionally, we could simplify the semantics of **If**, at the
|
||||
expense of breaking the system, by creating a macro that works as
|
||||
if and only if `*[a b]` produces either `0` or `1`.
|
||||
|
||||
This simpler **If** would be:
|
||||
|
||||
:: *[a 6 b c d] *[a 2 [0 1] 2 [1 c d] [1 0] [4 4 b]]
|
||||
|
||||
which reduces to:
|
||||
|
||||
*[a *[[c d] [0 ++*[a b]]]]
|
||||
|
||||
Let's examine the internals of this macro with a test example:
|
||||
|
||||
*[[40 43] [6 [3 0 1] [4 0 2] [4 0 1]]]
|
||||
|
||||
Fitting this to the reduced form:
|
||||
|
||||
*[[40 43] *[[4 0 2] [4 0 3]] [0 ++*[[40 43] [3 0 1]]]]]
|
||||
|
||||
Our test:
|
||||
|
||||
*[[40 43] [3 0 1]]
|
||||
|
||||
produces a 0,
|
||||
|
||||
*[[40 43] *[[[4 0 2] [4 0 3]] [0 ++0]]]]
|
||||
|
||||
which gets incremented twice
|
||||
|
||||
*[[40 43] *[[[4 0 2] [4 0 3]] [0 2]]]
|
||||
|
||||
and is used as an axis to select the head of [[4 0 2] [4 0 3]]
|
||||
|
||||
*[[40 43] [4 0 2]]
|
||||
|
||||
which increments `40` to produce `41`. Had the **test** produced a "no" instead of a
|
||||
"yes", **If** would have incremented the **tail** of the subject instead of the
|
||||
**head**.
|
||||
|
||||
The real **If** is only slightly more complicated:
|
||||
|
||||
:: *[a 6 b c d] *[a *[[c d] [0 *[[2 3] [0 ++*[a b]]]]]]
|
||||
|
||||
There is an extra step in the real **If** to prevent unexpected behaviour if the
|
||||
test produces a value other than 0 ("yes") or 1 ("no"). The real **If** will
|
||||
crash if this happens and the naive **If** may not (the reader will find it a
|
||||
useful exercise to figure out why).
|
||||
|
||||
It's worth noting that practical, compiler-generated Nock never does anything as
|
||||
funky as these **Operator 6** macro internals.
|
||||
|
||||
##Operator 7: Compose
|
||||
|
||||
33 :: *[a 7 b c] *[a 2 b 1 c]
|
||||
|
||||
**Operator 7** implements function composition. To use a bit of math
|
||||
notation, if we define the formula `[7 b c]` as a function `d(x)`:
|
||||
|
||||
d(a) == c(b(a))
|
||||
|
||||
This is apparent from the reduced pseudocode form of **Operator 7**:
|
||||
|
||||
*[*[a b] c]
|
||||
|
||||
As an example,
|
||||
|
||||
*[[42 44] [7 [4 0 3] [3 0 1]]] -> 1
|
||||
|
||||
The above sequentially applies the **formulas** `[4 0 3]` and `[3 0 1]`
|
||||
to our subject `[42 44]`, first incrementing the **head**, then testing
|
||||
the **depth**.
|
||||
|
||||
##Operator 8: Push
|
||||
|
||||
34 :: *[a 8 b c] *[a 7 [[7 [0 1] b] 0 1] c]
|
||||
|
||||
**Operator 8** pushes a new **noun** onto our **subject**, not at all unlike
|
||||
pushing a new variable onto the stack.
|
||||
|
||||
The internals of **Operator 8** are similar to **Operator 7**, except
|
||||
that the **subject** for `c` is not simply the **product** of `b`, but the
|
||||
ordered pair of the **product** of `b` and the original **subject**.
|
||||
|
||||
This is apparent from the reduced pseudocode form of **Operator 8**:
|
||||
|
||||
*[[*[a b] a] c]
|
||||
|
||||
**Operator 8** evaluates the **formula** `c` with the **cell** of `*[a b]` and
|
||||
the original **subject** `a`. In math notation, if we define `[8 b c]` as
|
||||
`d(x)`:
|
||||
|
||||
d(a) == c([b(a) a])
|
||||
|
||||
Suppose, for the purposes of the **formula** `c`, we need not just the
|
||||
**subject** `a`, but some intermediate **noun** computed from the **subject**
|
||||
that will be useful in the calculation of `c`. **Operator 8** applies
|
||||
**formula** `c` to a new **subject** that is the pair of the intermediate value
|
||||
and the old **subject**.
|
||||
|
||||
In higher-level languages that compile to Nock, variable declarations are likely
|
||||
to generate an **Operator 8**, because the variable is computed against the
|
||||
present **subject**, and used in a calculation which depends both on the
|
||||
original **subject** and the new variable.
|
||||
|
||||
|
||||
##Op 9: Call
|
||||
|
||||
35 :: *[a 9 b c] *[a 7 c 2 [0 1] 0 b]
|
||||
|
||||
|
||||
##Op 10: Hint
|
||||
|
||||
36 :: *[a 10 [b c] d] *[a 8 c 7 [0 3] d]
|
||||
37 :: *[a 10 b c] *[a c]
|
||||
|
||||
##Crash default
|
||||
|
||||
39 :: *a *a
|
@ -2,13 +2,10 @@
|
||||
:::: /hoon/core/down/pro
|
||||
::
|
||||
/? 314
|
||||
/- maud
|
||||
!:
|
||||
:::: describe
|
||||
::
|
||||
=+ maud
|
||||
::
|
||||
:::: compute
|
||||
/- markdown
|
||||
=+ markdown
|
||||
!:
|
||||
::::
|
||||
::
|
||||
|_ don=down
|
||||
++ grab :: convert from
|
||||
@ -20,6 +17,7 @@
|
||||
++ mark
|
||||
|= p=tape
|
||||
(scan p apex)
|
||||
::
|
||||
++ apex :: markdown parser
|
||||
|= tub=nail
|
||||
^- (like down)
|
||||
@ -29,23 +27,23 @@
|
||||
%- some :_ [p.sep ~]
|
||||
(turn p.u.q.sep |=(a=tape (scan a blos)))
|
||||
::
|
||||
++ base %+ stag %para
|
||||
++ base %+ stag %par
|
||||
;~ plug
|
||||
(stag %text (plus ;~(pose prn eol)))
|
||||
(stag %tex (plus ;~(pose prn eol)))
|
||||
(easy ~)
|
||||
==
|
||||
::
|
||||
++ blos :: block element
|
||||
%+ knee *bloc |. ~+
|
||||
%+ knee *barb |. ~+
|
||||
;~ pose
|
||||
head quot lasd horz
|
||||
code codf html para base
|
||||
==
|
||||
::
|
||||
++ brek (stag %brek (cold ~ ;~(plug fas fas))) :: line break
|
||||
++ chrd ;~(pose escp prn (cold ' ' eol)) :: span character data
|
||||
++ brek (stag %cut (cold ~ ;~(plug fas fas))) :: line break
|
||||
++ chrd ;~(pose escp prn (cold ' ' eol)) :: shin character data
|
||||
++ code :: code block
|
||||
%+ stag %code
|
||||
%+ stag %pre
|
||||
%- full
|
||||
%- plus
|
||||
;~ pfix (stun [4 4] ace)
|
||||
@ -57,7 +55,7 @@
|
||||
==
|
||||
::
|
||||
++ codf :: fenced code block
|
||||
%+ stag %code
|
||||
%+ stag %pre
|
||||
%- full
|
||||
%+ ifix
|
||||
[;~(plug tec tec tec eol) ;~(plug tec tec tec)]
|
||||
@ -68,8 +66,8 @@
|
||||
(full (plus ;~(less ;~(plug tec tec tec) prn)))
|
||||
==
|
||||
::
|
||||
++ cods :: code span
|
||||
%+ stag %cods
|
||||
++ cods :: code shin
|
||||
%+ stag %cod
|
||||
=+ chx=;~(pose (cold ' ' eol) prn)
|
||||
;~ pose
|
||||
%+ ifix [(jest '```') (jest '```')]
|
||||
@ -84,7 +82,7 @@
|
||||
;~(plug sig sig)
|
||||
;~(plug fas fas)
|
||||
==
|
||||
++ spas :: all span elements
|
||||
++ spas :: all shin elements
|
||||
|* res=_rule
|
||||
%- plus
|
||||
;~ pose emph stri link
|
||||
@ -93,8 +91,8 @@
|
||||
::
|
||||
++ eol (just `@`10) :: newline
|
||||
++ emph :: emphasis
|
||||
%+ knee *span |. ~+
|
||||
%+ stag %emph
|
||||
%+ knee *shin |. ~+
|
||||
%+ stag %emp
|
||||
=+ inn=(plus ;~(pose cods stri link (text fail)))
|
||||
;~ pose
|
||||
(ifix [(jest '***') (jest '***')] (stag %both inn))
|
||||
@ -105,8 +103,8 @@
|
||||
(ifix [(jest '___') (jest '___')] (stag %both inn))
|
||||
(ifix [(jest '**') (jest '**')] (stag %bold inn))
|
||||
(ifix [(jest '__') (jest '__')] (stag %bold inn))
|
||||
(ifix [tar tar] (stag %ital inn))
|
||||
(ifix [cab cab] (stag %ital inn))
|
||||
(ifix [tar tar] (stag %bent inn))
|
||||
(ifix [cab cab] (stag %bent inn))
|
||||
==
|
||||
::
|
||||
++ escp :: escapable chars
|
||||
@ -124,7 +122,7 @@
|
||||
==
|
||||
::
|
||||
++ head :: header
|
||||
%+ stag %head
|
||||
%+ stag %had
|
||||
=+ ^= hed
|
||||
;~ pose
|
||||
;~ plug
|
||||
@ -154,7 +152,7 @@
|
||||
==
|
||||
::
|
||||
++ horz :: horizontal rule
|
||||
%+ stag %horz
|
||||
%+ stag %hot
|
||||
%+ cold ~
|
||||
%- full
|
||||
;~ pose
|
||||
@ -163,9 +161,9 @@
|
||||
;~(plug (stun [0 3] ace) cab wits cab wits cab (star ;~(pose cab wite)))
|
||||
==
|
||||
::
|
||||
++ html (stag %html apex:xmlp) :: html bloc
|
||||
++ html (stag %hem apex:xmlp) :: html barb
|
||||
++ lasd :: top level list
|
||||
%+ stag %list
|
||||
%+ stag %lit
|
||||
%- full
|
||||
;~ pose
|
||||
(stag & (lisd ;~(plug (star nud) dot)))
|
||||
@ -181,7 +179,7 @@
|
||||
=+ chx=;~(plug (plus prn) (cold "\0a" eol))
|
||||
=- ?~ q.pre pre
|
||||
:- p.pre %- some
|
||||
[(turn `wall`p.u.q.pre |=(a=tape [%lise (scan a apex)])) [p.pre ~]]
|
||||
[(turn `wall`p.u.q.pre |=(a=tape [%lie (scan a apex)])) [p.pre ~]]
|
||||
^= pre %. tub
|
||||
%+ most ;~(pose ;~(plug wits eol) (easy ~))
|
||||
%+ cook |=(a=wall `tape`(zing a)) :: XX core dump w/o cast
|
||||
@ -200,8 +198,8 @@
|
||||
==
|
||||
::
|
||||
++ link :: link element
|
||||
%+ knee *span |. ~+
|
||||
%+ stag %link
|
||||
%+ knee *shin |. ~+
|
||||
%+ stag %lin
|
||||
;~ plug
|
||||
(ifix [sel ser] (plus ;~(pose emph stri cods (text ser))))
|
||||
;~ pose
|
||||
@ -215,9 +213,9 @@
|
||||
==
|
||||
==
|
||||
::
|
||||
++ para (stag %para (full (spas fail))) :: paragraph
|
||||
++ para (stag %par (full (spas fail))) :: paragraph
|
||||
++ quot :: blockquotes
|
||||
%+ stag %quot
|
||||
%+ stag %quo
|
||||
%- full
|
||||
|= tub=nail
|
||||
^- (like down)
|
||||
@ -234,7 +232,7 @@
|
||||
==
|
||||
==
|
||||
::
|
||||
++ sepa :: separate blocs
|
||||
++ sepa :: separate barbs
|
||||
%+ knee *wall |. ~+
|
||||
=+ lin=;~(plug eol wits eol)
|
||||
%+ ifix [(star whit) (star whit)]
|
||||
@ -271,11 +269,11 @@
|
||||
==
|
||||
::
|
||||
++ stri :: strikethrough text
|
||||
%+ stag %stri
|
||||
%+ stag %ike
|
||||
%+ ifix [(jest '~~') (jest '~~')]
|
||||
(plus ;~(pose emph cods link (text fail)))
|
||||
::
|
||||
++ text |*(res=_rule (stag %text (plus ;~(less ;~(pose res dont) chrd))))
|
||||
++ text |*(res=_rule (stag %tex (plus ;~(less ;~(pose res dont) chrd))))
|
||||
++ whit (mask ~[`@`0x20 `@`0x9 `@`0xa]) :: whitespace w/nl
|
||||
++ wite (mask ~[`@`0x20 `@`0x9]) :: whitespace
|
||||
++ wits (star wite)
|
||||
@ -289,7 +287,7 @@
|
||||
::
|
||||
++ grow :: convert into
|
||||
|%
|
||||
++ html :: convert into %html
|
||||
++ html :: convert into %heml
|
||||
=< :(appd '<html><body>' (abet don) '</body></html>')
|
||||
|%
|
||||
++ abet
|
||||
@ -299,37 +297,37 @@
|
||||
^- @
|
||||
(cat 3 p q)
|
||||
::
|
||||
++ apex |=(don=down (turn don |=(bol=bloc (blok bol))))
|
||||
++ apex |=(don=down (turn don |=(bol=barb (blok bol))))
|
||||
++ blok
|
||||
|= bol=bloc
|
||||
|= bol=barb
|
||||
^- manx
|
||||
?- bol
|
||||
[%head *]
|
||||
[%had *]
|
||||
:_ (turn q.bol sank)
|
||||
[(cat 3 'h' (scot %ud p.bol)) ?~(r.bol ~ [[%id u.r.bol] ~])]
|
||||
[%para *] [[%p ~] (turn p.bol sank)]
|
||||
[%horz *] [[%hr ~] ~]
|
||||
[%code *] [[%pre ~] ~[[[%$ [[%$ (zing p.bol)] ~]] ~]]]
|
||||
[%quot *] [[%blockquote ~] (apex p.bol)]
|
||||
[%lise *] [[%li ~] (apex p.bol)]
|
||||
[%list *] ?: =(& p.bol) [[%ol ~] (apex q.bol)]
|
||||
[%par *] [[%p ~] (turn p.bol sank)]
|
||||
[%hot *] [[%hr ~] ~]
|
||||
[%pre *] [[%pre ~] ~[[[%$ [[%$ (zing p.bol)] ~]] ~]]]
|
||||
[%quo *] [[%blockquote ~] (apex p.bol)]
|
||||
[%lie *] [[%li ~] (apex p.bol)]
|
||||
[%lit *] ?: =(& p.bol) [[%ol ~] (apex q.bol)]
|
||||
[[%ul ~] (apex q.bol)]
|
||||
[%html *] p.bol
|
||||
[%hem *] p.bol
|
||||
==
|
||||
::
|
||||
++ sank
|
||||
|= san=span
|
||||
|= san=shin
|
||||
^- manx
|
||||
?- san
|
||||
[%text *] [[%$ [[%$ p.san] ~]] ~]
|
||||
[%brek *] [[%br ~] ~]
|
||||
[%stri *] [[%del ~] (turn p.san ..$)]
|
||||
[%cods *] [[%code ~] ~[[[%$ [[%$ p.san] ~]] ~]]]
|
||||
[%emph *]
|
||||
?: =(%ital p.san) [[%em ~] (turn q.san ..$)]
|
||||
[%tex *] [[%$ [[%$ p.san] ~]] ~]
|
||||
[%cut *] [[%br ~] ~]
|
||||
[%ike *] [[%del ~] (turn p.san ..$)]
|
||||
[%cod *] [[%pre ~] ~[[[%$ [[%$ p.san] ~]] ~]]]
|
||||
[%emp *]
|
||||
?: =(%bent p.san) [[%em ~] (turn q.san ..$)]
|
||||
?: =(%bold p.san) [[%strong ~] (turn q.san ..$)]
|
||||
[[%em ~] ~[[[%strong ~] (turn q.san ..$)]]]
|
||||
[%link *]
|
||||
[%lin *]
|
||||
?~ r.san [[%a ~[[%href q.san]]] (turn p.san ..$)]
|
||||
[[%a ~[[%href q.san] [%title u.r.san]]] (turn p.san ..$)]
|
||||
==
|
||||
|
@ -3,13 +3,45 @@
|
||||
::
|
||||
/? 314
|
||||
/- zong
|
||||
|_ zog=(list zong)
|
||||
|_ zos=(list zong)
|
||||
::
|
||||
++ grab :: convert from
|
||||
|%
|
||||
++ noun :: convert from %noun
|
||||
|= src=*
|
||||
^+ +>+
|
||||
+>+(zog ((list zong) src))
|
||||
+>+(zos ((list zong) src))
|
||||
--
|
||||
::
|
||||
++ grow :: convert to
|
||||
|%
|
||||
++ hymn :: convert to %hymn
|
||||
^- manx
|
||||
;html
|
||||
;head
|
||||
;title: Zongs!
|
||||
==
|
||||
;body ;table
|
||||
;* %+ turn zos
|
||||
|= zog=zong
|
||||
=. p.zog (lsh 6 1 (rsh 6 1 p.zog)) :: round off subsecond
|
||||
;tr ;td: {<p.zog>}
|
||||
;td: {<q.zog>}
|
||||
;+ ?- -.r.zog
|
||||
%do
|
||||
;td: {(trip p.r.zog)}
|
||||
%say
|
||||
;td: & {(trip p.r.zog)}
|
||||
%exp
|
||||
;td
|
||||
;code:"{(trip p.r.zog)}"
|
||||
; \a0 {~(ram re q.r.zog)}
|
||||
== ==
|
||||
== ==
|
||||
== ==
|
||||
++ html
|
||||
(crip (xmlt | hymn ~))
|
||||
++ mime
|
||||
[/text/html (taco html)]
|
||||
--
|
||||
--
|
||||
|
@ -1,15 +0,0 @@
|
||||
$& [p=down q=down]
|
||||
$% [%$ p=tape]
|
||||
[%code p=tape]
|
||||
[%inco p=tape]
|
||||
[%head p=@ud q=down]
|
||||
[%link p=tape q=tape r=(unit tape)]
|
||||
[%lord p=(list down)]
|
||||
[%lund p=(list down)]
|
||||
[%parg p=down]
|
||||
[%quot p=down]
|
||||
[%rong p=down]
|
||||
[%emph p=down]
|
||||
[%hrul ~]
|
||||
[%html p=tape]
|
||||
==
|
@ -1,22 +0,0 @@
|
||||
|%
|
||||
++ down (list bloc) :: markdown model
|
||||
++ bloc :: block elements
|
||||
$% [%head p=@ud q=(list span) r=(unit tape)]
|
||||
[%para p=(list span)]
|
||||
[%lise p=down]
|
||||
[%list p=? q=down]
|
||||
[%quot p=down]
|
||||
[%horz ~]
|
||||
[%code p=wall]
|
||||
[%html p=manx]
|
||||
==
|
||||
::
|
||||
++ span :: span elements
|
||||
$% [%text p=tape]
|
||||
[%emph p=term q=(list span)]
|
||||
[%stri p=(list span)]
|
||||
[%brek ~]
|
||||
[%link p=(list span) q=tape r=(unit tape)]
|
||||
[%cods p=tape]
|
||||
==
|
||||
--
|
1
main/sur/foobar/gate.hoon
Normal file
1
main/sur/foobar/gate.hoon
Normal file
@ -0,0 +1 @@
|
||||
,@
|
21
main/sur/markdown/gate.hoon
Normal file
21
main/sur/markdown/gate.hoon
Normal file
@ -0,0 +1,21 @@
|
||||
|%
|
||||
++ down (list barb) :: markdown structure
|
||||
++ barb :: block elements
|
||||
$% [%had p=@ud q=(list shin) r=(unit tape)] :: depth, contents, id
|
||||
[%hem p=manx] :: html tag
|
||||
[%hot ~] :: horizontal rule
|
||||
[%lie p=down] :: list element
|
||||
[%lit p=? q=down] :: list
|
||||
[%par p=(list shin)] :: paragraph
|
||||
[%pre p=wall] :: preformatted text
|
||||
[%quo p=down] :: blockquote
|
||||
== ::
|
||||
++ shin :: span elements
|
||||
$% [%cod p=tape] :: inline code
|
||||
[%cut ~] :: break
|
||||
[%emp p=?(%bent %bold %both) q=(list shin)] :: emphasis
|
||||
[%ike p=(list shin)] :: strikethrough
|
||||
[%lin p=(list shin) q=tape r=(unit tape)] :: link
|
||||
[%tex p=tape] :: text
|
||||
== ::
|
||||
--
|
Loading…
Reference in New Issue
Block a user