zuse: add +balk core for remote scry path format

+balk defines a datastructure for a parsed remote scry path format in
addition to conversion gates to and from paths.

The new scry path format is /~ship/rift/life/vane/care/spur. Note that
desk no longer appears in the scry path format and should instead be
encoded as the first item of the spur.
This commit is contained in:
Liam Fitzgerald 2022-03-08 14:49:47 -06:00
parent b4da246f01
commit e621744169
2 changed files with 70 additions and 0 deletions

View File

@ -5515,4 +5515,57 @@
?. ?=(%soft -.wrapped)
wrapped
;;(task +.wrapped)
::
::
++ balk
=< bulk
|%
+$ bulk
$: [her=ship rif=rift lyf=life]
[van=@ta car=@ta cas=case]
spr=spur
==
::
++ de-path-soft
|= [=rift =life =path]
^- (unit bulk)
:: [care ship desk case path]
?. ?=([@ @ @ @ *] path)
~
=/ van=@ta (end 3 i.path)
=/ car=@ta (rsh 3 i.path)
?~ her=(slaw %p i.t.path)
~
?~ cas=(de-case i.t.t.t.path)
~
:- ~
:* [u.her rift life]
[van car u.cas]
[i.t.t.path t.t.t.t.path]
==
::
++ de-path
|= [=rift =life =path]
^- bulk
(need (de-path-soft +<))
::
++ en-path
|= =bulk
^- path
?> ?=([@ *] spr.bulk)
:* (cat 3 van.bulk car.bulk)
(scot %p her.bulk)
i.spr.bulk
(scot cas.bulk)
t.spr.bulk
==
::
++ en-roof
|= =bulk
^- (unit [vis=view bem=beam])
?. ?=(^ spr.bulk) ~
=/ bem=beam [[her i.spr cas] t.spr]:bulk
=+ vis=(cat 3 van.bulk car.bulk)
`[vis bem]
--
--

View File

@ -0,0 +1,17 @@
/+ *test
|%
++ hastuc-dibtux [~hastuc-dibtux 15 22]
++ clay-x [%c %x %ud 3]
++ test-en-path
%+ expect-eq
!>(`path`/cx/~hastuc-dibtux/base/3/sys/hoon/hoon)
!> %- en-path:balk
[hastuc-dibtux clay-x /base/sys/hoon/hoon]
++ test-de-path
=/ bal=balk
(de-path:balk 15 22 /cx/~hastuc-dibtux/base/3/sys/hoon/hoon)
%+ expect-eq !>(bal)
!> ^- balk
[hastuc-dibtux clay-x /base/sys/hoon/hoon]
--