back

oxal vision

file is an (oxal page)

if is an engine for common operations on file


oxal is like axal but with two differences.

  1. it addresses by pith (instead of path)

  2. it orders children intuitively by the pith's iotas (instead of by +mug hash)

these differences are useful because you can rely on the order after tap or dir as a programmer without needing to do expensive sorts.

+if is an engine for the common file operations (like +of for axal)

type definitions
+$  page  ::  typed data
  $+  page
  $~  [p=%n q=~]
  $%  [p=%ub q=@ub]  [p=%uc q=@uc]  [p=%ud q=@ud]  [p=%ui q=@ui]
      [p=%ux q=@ux]  [p=%uv q=@uv]  [p=%uw q=@uw]
      [p=%sb q=@sb]  [p=%sc q=@sc]  [p=%sd q=@sd]  [p=%si q=@si]
      [p=%sx q=@sx]  [p=%sv q=@sv]  [p=%sw q=@sw]
      [p=%da q=@da]  [p=%dr q=@dr]
      [p=%f q=?]     [p=%n q=~]
      [p=%if q=@if]  [p=%is q=@is]
      [p=%t q=@t]    [p=%ta q=@ta]  [p=%tas q=@tas]
      [p=%p q=@p]    [p=%q q=@q]
      [p=%rs q=@rs]  [p=%rd q=@rd]  [p=%rh q=@rh]  [p=%rq q=@rq]
      ::
      [p=%code q=@t]
      [p=%hoon q=hoon]
      [p=%mime q=mime]
      [p=%pith q=pith]
      [p=%iota q=iota]
      [p=%tang q=tang]
  ==
++  oxal
  |$  [item]
  [fil=(unit item) dir=((mop iota $) comp-iotas)]
++  file  (oxal page)
++  ion  ((on iota file) comp-iotas)
++  comp-iotas
  |=  [a=* b=*]
  ^-  ?
  =>  .(a ?@(a [%tas a] a), b ?@(b [%tas b] b))
  ?>  ?=([@ @] a)
  ?>  ?=([@ @] b)
  ?.  =(-.a -.b)                 (aor -.a -.b)
  ?:  ?=(?(%t %ta %tas %f) -.a)  (aor +.a +.b)
  (lte +.a +.b)

view page's hawk code

this shape, file, is a solid foundation for a recursive interface application system.

hawk intends to realize this recursive vision, integrated with an editor.


if: file engine


test data

this is the file used in the rest of the examples.

x is the face bound to an file engine (++if) with a the test data mounted.

=/  f  ~(. if test-data)
code
raw:f
result: file
/
~
~
poke
[code]
%code
~|(%zip-zap-bang !!)
beep
~
~
poke
[code]
%code
%+ ~(put if file) / tas+%initialized
foo
~
~
poke
/beep
%pith
/beep
bar
~
~
baz
ud+5
%ud
ud+5
poke
[code]
%code
%- gas:f :~ :+ / %ud =/ x (gut:c / ud+0) =/ y (gut:f / ud+0) ?> ?=(%ud p.x) ?> ?=(%ud p.y) (add q.x q.y) :- /testo tas+%besto ==

build

build the code in the file
and resolves any mirrors

code
(build raw:f)
result: file
/
~
~
poke
[code]
%code
~|(%zip-zap-bang !!)
hoon
[hoon]
%hoon
[ %sgbr p [ %rock p=%tas q=32.010.397.732.360.132.973.466.511.738 ] q=[%zpzp ~] ]
beep
~
~
poke
[code]
%code
%+ ~(put if file) / tas+%initialized
hoon
[hoon]
%hoon
[ %cnls p [ %cnsg p=~[%put] q=[%wing p=~[%if]] r=[i=[%wing p=~[%file]] t=~] ] q=[%clsg p=~] r [ p=[%rock p=%tas q=7.561.588] q [ %rock p=%tas q=121.371.799.075.563.521.222.209.129 ] ] ]
foo
~
~
poke
/beep
%pith
/beep
hoon
[hoon]
%hoon
[ %cnls p [ %cnsg p=~[%put] q=[%wing p=~[%if]] r=[i=[%wing p=~[%file]] t=~] ] q=[%clsg p=~] r [ p=[%rock p=%tas q=7.561.588] q [ %rock p=%tas q=121.371.799.075.563.521.222.209.129 ] ] ]
bar
~
~
baz
ud+5
%ud
ud+5
poke
[code]
%code
%- gas:f :~ :+ / %ud =/ x (gut:c / ud+0) =/ y (gut:f / ud+0) ?> ?=(%ud p.x) ?> ?=(%ud p.y) (add q.x q.y) :- /testo tas+%besto ==
hoon
[hoon]
%hoon
[ %cnhp p=[%tsgl p=[%wing p=~[%gas]] q=[%wing p=~[%f]]] q [ %clsg p [ i [ %clls p=[%clsg p=~] q=[%rock p=%tas q=25.717] r [ %tsfs p=term=%x q [ %cncl p [ %tsgl p=[%wing p=~[%gut]] q=[%wing p=~[%c]] ] q [ i=[%clsg p=~] t [ i [ p=[%rock p=%tas q=25.717] q=[%sand p=%ud q=0] ] t=~ ] ] ] r [ %tsfs p=term=%y q [ %cncl p [ %tsgl p=[%wing p=~[%gut]] q=[%wing p=~[%f]] ] q [ i=[%clsg p=~] t [ i [ p=[%rock p=%tas q=25.717] q=[%sand p=%ud q=0] ] t=~ ] ] ] r [ %wtgr p [ %wtts p=[%leaf p=%tas q=25.717] q=~[%p %x] ] q [ %wtgr p [ %wtts p=[%leaf p=%tas q=25.717] q=~[%p %y] ] q [ %cncl p=[%wing p=~[%add]] q [ i=[%wing p=~[%q %x]] t=[i=[%wing p=~[%q %y]] t=~] ] ] ] ] ] ] ] t [ i [ %clhp p [ %clsg p=[i=[%sand p=%tas q=478.695.089.524] t=~] ] q [ p=[%rock p=%tas q=7.561.588] q=[%rock p=%tas q=478.695.089.506] ] ] t=~ ] ] ] ]

poke

poke a card to /foo/baz/bar

the hoon at /foo/bar/baz/~/poke is compiled against /foo/bar/baz and the card and evaluates against a new ixal to put at /foo/bar/baz

this recurses up the tree triggering:
/foo/~/poke (which runs the code from /bar/~/poke)
then /~/poke (which crashes)

code
%^ poke /foo/bar/baz (~(gas if *file) [/ ud+12]~) (build raw:f)
result: file
/
~
~
error
[tang]
%tang
%zip-zap-bang /:<[456 5].[464 7]> /:<[455 5].[464 7]>
poke
[code]
%code
~|(%zip-zap-bang !!)
hoon
[hoon]
%hoon
[ %sgbr p [ %rock p=%tas q=32.010.397.732.360.132.973.466.511.738 ] q=[%zpzp ~] ]
beep
~
~
poke
[code]
%code
%+ ~(put if file) / tas+%initialized
hoon
[hoon]
%hoon
[ %cnls p [ %cnsg p=~[%put] q=[%wing p=~[%if]] r=[i=[%wing p=~[%file]] t=~] ] q=[%clsg p=~] r [ p=[%rock p=%tas q=7.561.588] q [ %rock p=%tas q=121.371.799.075.563.521.222.209.129 ] ] ]
foo
%initialized
%tas
%initialized
poke
/beep
%pith
/beep
hoon
[hoon]
%hoon
[ %cnls p [ %cnsg p=~[%put] q=[%wing p=~[%if]] r=[i=[%wing p=~[%file]] t=~] ] q=[%clsg p=~] r [ p=[%rock p=%tas q=7.561.588] q [ %rock p=%tas q=121.371.799.075.563.521.222.209.129 ] ] ]
bar
~
~
baz
ud+17
%ud
ud+17
poke
[code]
%code
%- gas:f :~ :+ / %ud =/ x (gut:c / ud+0) =/ y (gut:f / ud+0) ?> ?=(%ud p.x) ?> ?=(%ud p.y) (add q.x q.y) :- /testo tas+%besto ==
hoon
[hoon]
%hoon
[ %cnhp p=[%tsgl p=[%wing p=~[%gas]] q=[%wing p=~[%f]]] q [ %clsg p [ i [ %clls p=[%clsg p=~] q=[%rock p=%tas q=25.717] r [ %tsfs p=term=%x q [ %cncl p [ %tsgl p=[%wing p=~[%gut]] q=[%wing p=~[%c]] ] q [ i=[%clsg p=~] t [ i [ p=[%rock p=%tas q=25.717] q=[%sand p=%ud q=0] ] t=~ ] ] ] r [ %tsfs p=term=%y q [ %cncl p [ %tsgl p=[%wing p=~[%gut]] q=[%wing p=~[%f]] ] q [ i=[%clsg p=~] t [ i [ p=[%rock p=%tas q=25.717] q=[%sand p=%ud q=0] ] t=~ ] ] ] r [ %wtgr p [ %wtts p=[%leaf p=%tas q=25.717] q=~[%p %x] ] q [ %wtgr p [ %wtts p=[%leaf p=%tas q=25.717] q=~[%p %y] ] q [ %cncl p=[%wing p=~[%add]] q [ i=[%wing p=~[%q %x]] t=[i=[%wing p=~[%q %y]] t=~] ] ] ] ] ] ] ] t [ i [ %clhp p [ %clsg p=[i=[%sand p=%tas q=478.695.089.524] t=~] ] q [ p=[%rock p=%tas q=7.561.588] q=[%rock p=%tas q=478.695.089.506] ] ] t=~ ] ] ] ]
testo
%besto
%tas
%besto