mirror of
https://github.com/urbit/shrub.git
synced 2024-12-21 01:41:37 +03:00
hoon, vere: copy mino, etc. back to old names
This commit is contained in:
parent
66f8580127
commit
d6b28db521
@ -189,7 +189,7 @@
|
||||
~& [who=who %wished (slum wish txt)]
|
||||
..abet-pe
|
||||
::
|
||||
++ mox |=(* (moku [snap +<] scry))
|
||||
++ mox |=(* (mock [snap +<] scry))
|
||||
::
|
||||
:: Start/stop processing events. When stopped, events are added to
|
||||
:: our queue but not processed.
|
||||
@ -333,8 +333,8 @@
|
||||
=. this apex-aqua =< abet-aqua
|
||||
=. pil p
|
||||
~& lent=(met 3 (jam boot-ova.pil))
|
||||
=/ res=noot :: (each * (list tank))
|
||||
(moku [boot-ova.pil [2 [0 3] [0 2]]] scry)
|
||||
=/ res=toon :: (each * (list tank))
|
||||
(mock [boot-ova.pil [2 [0 3] [0 2]]] scry)
|
||||
=. fleet-snaps ~
|
||||
?- -.res
|
||||
%0
|
||||
|
@ -1,139 +0,0 @@
|
||||
:: test the behavior of the new mink (temporary file)
|
||||
:- %say
|
||||
|= [[now=@da * [our=@p *]] *]
|
||||
:- %noun
|
||||
?> ?= [%2 *]
|
||||
(mino [0 11 [%slog 1 2 leaf+"CHECK FOR ME"] 0 0] |=(* ~))
|
||||
=/ pass
|
||||
|= [ref=* gof=*]
|
||||
=/ fol [12 [1 ref] 1 gof]
|
||||
=/ pro .*(~ fol)
|
||||
``pro
|
||||
=/ good
|
||||
|= =path
|
||||
^- ?
|
||||
=/ raw=@t .^(@t %cx path)
|
||||
=/ virt=tono
|
||||
(mino [. !=(.^(@t %cx path))] pass)
|
||||
?. ?=(%0 -.virt) |
|
||||
=(product.virt raw)
|
||||
?> (good /(scot %p our)/home/(scot %da now)/gen/hello/hoon)
|
||||
=/ scry
|
||||
|= [a=* b=*]
|
||||
^- (unit (unit))
|
||||
=/ al=? (? a)
|
||||
:: not a (list @ta), so mush will give an empty rose
|
||||
=/ c=(pair path *) ((pair path *) b)
|
||||
?. &(=(a al) =(b c)) [~ ~]
|
||||
?. al ~
|
||||
?~ p.c [~ ~]
|
||||
``q.c
|
||||
?> ?&
|
||||
=([%0 42] (mino [0 12 [1 0] [1 /foo] 1 42] scry))
|
||||
=([%1 /foo 42] (mino [0 12 [1 1] [1 /foo] 1 42] scry))
|
||||
=([%1 0 42] (mino [0 12 [1 1] [1 ~] 1 42] scry))
|
||||
?=([%2 *] (mino [0 12 [1 0] [1 ~] 1 42] scry))
|
||||
.= :- 2
|
||||
:~ [%spot 1]
|
||||
[%lose 2]
|
||||
[%mean 3]
|
||||
:: [%hand 4]
|
||||
[%hunk 5]
|
||||
==
|
||||
%+ mino
|
||||
:- 0
|
||||
:* 11 [%hunk 1 5]
|
||||
:: 11 [%hand 1 4]
|
||||
11 [%mean 1 3]
|
||||
11 [%lose 1 2]
|
||||
11 [%spot 1 1]
|
||||
0 0
|
||||
==
|
||||
|=(* ~)
|
||||
==
|
||||
=/ tests=(list [subject=* formula=* product=(unit *)])
|
||||
:~ :+ 0 [0 0] ~
|
||||
:+ 0 [0 1] `0
|
||||
:+ 0 [0 2] ~
|
||||
:+ [0 1 2] [0 2] `0
|
||||
:+ [0 1 2] [0 3] `[1 2]
|
||||
:+ [0 1 2] [0 4] ~
|
||||
:+ [0 1 2] [0 5] ~
|
||||
:+ [0 1 2] [0 6] `1
|
||||
:+ [0 1 2] [0 7] `2
|
||||
:+ 0 [1 42] `42
|
||||
:+ 0 [1 1 2 3 4] `[1 2 3 4]
|
||||
:+ [[0 3] 1 2 3] [2 [0 3] 0 2] `[2 3]
|
||||
:+ 42 [3 0 1] `1
|
||||
:+ [0 42] [3 0 1] `0
|
||||
:+ 41 [4 0 1] `42
|
||||
:+ [0 41] [4 0 1] ~
|
||||
:+ [42 43] [5 [0 2] [0 3]] `1
|
||||
:+ [42 43] [5 [4 0 2] [0 3]] `0
|
||||
:+ [42 43] [5 0 1] ~
|
||||
:+ 0 [6 [1 0] [1 42] 0] `42
|
||||
:+ 0 [6 [1 1] [1 42] 0] ~
|
||||
:+ 0 [6 [1 0] [1 42] 1 43] `42
|
||||
:+ 0 [6 [1 1] [1 42] 1 43] `43
|
||||
:+ 0 [6 [1 2] [1 42] 1 42] ~
|
||||
:+ 0 [7 [1 2 3] 4 4 4 0 2] `5
|
||||
:+ 0 [8 [1 2 3] 4 4 4 0 4] `5
|
||||
:+ 0 [8 [1 2 3] 0 3] `0
|
||||
:+ 0 [9 2 1 [0 6] 42 0] `42
|
||||
:+ [0 0 42] [7 [10 [6 0 7] 0 1] 0 6] `42
|
||||
:+ [0 0] [10 [1 1 42] 0 2] `42
|
||||
:+ 0 [10 [1 1 42] 0 2] ~
|
||||
:+ 0 [10 [2 1 42] 0 1] ~
|
||||
:+ 0 [10 [3 1 42] 0 1] ~
|
||||
:+ [0 0] [10 [3 1 42] 0 1] `[0 42]
|
||||
:+ [0 0] [10 [2 1 42] 0 1] `[42 0]
|
||||
:+ [0 0 0] [10 [6 1 42] 0 1] `[0 42 0]
|
||||
:+ [0 0 0] [10 [7 1 42] 0 1] `[0 0 42]
|
||||
:+ 0 [11 %hint 1 42] `42
|
||||
:+ 0 [11 [%hint 1 42] 1 42] `42
|
||||
:+ 0 [11 [%hint 0] 1 42] ~
|
||||
:+ 0 != =< (fib 5)
|
||||
|%
|
||||
++ dec
|
||||
|= n=@
|
||||
?: =(0 n) !!
|
||||
=| i=@
|
||||
|-
|
||||
=/ ip +(i)
|
||||
?: =(n ip) i
|
||||
$(i ip)
|
||||
++ add
|
||||
|= [a=@ b=@]
|
||||
?: =(0 a) b
|
||||
$(a (dec a), b +(b))
|
||||
++ mul
|
||||
|= [a=@ b=@]
|
||||
?: |(=(0 a) =(0 b)) 0
|
||||
=/ r=@ a
|
||||
|-
|
||||
?: =(b 1) r
|
||||
$(b (dec b), r (add a r))
|
||||
++ fib
|
||||
|= n=@
|
||||
?: =(0 n) 0
|
||||
=/ a=@ 1
|
||||
|-
|
||||
?: =(1 n) a
|
||||
$(n (dec n), a (mul a n))
|
||||
--
|
||||
[~ :(mul 5 4 3 2)]
|
||||
==
|
||||
=/ scry |=(* ~)
|
||||
|- ^- ?
|
||||
?~ tests &
|
||||
=/ t i.tests
|
||||
=/ r (mino [subject.t formula.t] scry)
|
||||
?~ product.t
|
||||
?. ?=(%0 -.r)
|
||||
$(tests t.tests)
|
||||
~& [no-crash=t got=product.r]
|
||||
%.n
|
||||
?: &(?=(%0 -.r) =(product.r u.product.t))
|
||||
$(tests t.tests)
|
||||
~& [failed=t got=r]
|
||||
%.n
|
@ -4016,10 +4016,18 @@
|
||||
{$1 block/*} :: single block
|
||||
{$2 trace/(list {@ta *})} :: error report
|
||||
== ::
|
||||
++ tone $% {$0 product/*} :: success
|
||||
{$1 block/*} :: single block
|
||||
{$2 trace/(list {@ta *})} :: error report
|
||||
== ::
|
||||
++ noot $% {$0 p/*} :: success
|
||||
{$1 p/*} :: block
|
||||
{$2 p/(list tank)} :: stack trace
|
||||
== ::
|
||||
++ toon $% {$0 p/*} :: success
|
||||
{$1 p/*} :: block
|
||||
{$2 p/(list tank)} :: stack trace
|
||||
== ::
|
||||
++ wonk =+ veq=$:edge :: product from edge
|
||||
|@ ++ $ ?~(q.veq !! p.u.q.veq) ::
|
||||
-- ::
|
||||
@ -6498,11 +6506,239 @@
|
||||
[u.mutant +.target]
|
||||
[-.target u.mutant]
|
||||
--
|
||||
::
|
||||
++ mink !.
|
||||
~/ %mink
|
||||
|= $: [subject=* formula=*]
|
||||
scry=$-(^ (unit (unit)))
|
||||
==
|
||||
=| trace=(list [@ta *])
|
||||
|^ ^- tone
|
||||
?+ formula [%2 trace]
|
||||
[^ *]
|
||||
=/ head $(formula -.formula)
|
||||
?. ?=(%0 -.head) head
|
||||
=/ tail $(formula +.formula)
|
||||
?. ?=(%0 -.tail) tail
|
||||
[%0 product.head product.tail]
|
||||
::
|
||||
[%0 axis=@]
|
||||
=/ part (frag axis.formula subject)
|
||||
?~ part [%2 trace]
|
||||
[%0 u.part]
|
||||
::
|
||||
[%1 constant=*]
|
||||
[%0 constant.formula]
|
||||
::
|
||||
[%2 subject=* formula=*]
|
||||
=/ subject $(formula subject.formula)
|
||||
?. ?=(%0 -.subject) subject
|
||||
=/ formula $(formula formula.formula)
|
||||
?. ?=(%0 -.formula) formula
|
||||
%= $
|
||||
subject product.subject
|
||||
formula product.formula
|
||||
==
|
||||
::
|
||||
[%3 argument=*]
|
||||
=/ argument $(formula argument.formula)
|
||||
?. ?=(%0 -.argument) argument
|
||||
[%0 .?(product.argument)]
|
||||
::
|
||||
[%4 argument=*]
|
||||
=/ argument $(formula argument.formula)
|
||||
?. ?=(%0 -.argument) argument
|
||||
?^ product.argument [%2 trace]
|
||||
[%0 .+(product.argument)]
|
||||
::
|
||||
[%5 a=* b=*]
|
||||
=/ a $(formula a.formula)
|
||||
?. ?=(%0 -.a) a
|
||||
=/ b $(formula b.formula)
|
||||
?. ?=(%0 -.b) b
|
||||
[%0 =(product.a product.b)]
|
||||
::
|
||||
[%6 test=* yes=* no=*]
|
||||
=/ result $(formula test.formula)
|
||||
?. ?=(%0 -.result) result
|
||||
?: =(& product.result)
|
||||
$(formula yes.formula)
|
||||
?: =(| product.result)
|
||||
$(formula no.formula)
|
||||
[%2 trace]
|
||||
::
|
||||
[%7 subject=* next=*]
|
||||
=/ subject $(formula subject.formula)
|
||||
?. ?=(%0 -.subject) subject
|
||||
%= $
|
||||
subject product.subject
|
||||
formula next.formula
|
||||
==
|
||||
::
|
||||
[%8 head=* next=*]
|
||||
=/ head $(formula head.formula)
|
||||
?. ?=(%0 -.head) head
|
||||
%= $
|
||||
subject [product.head subject]
|
||||
formula next.formula
|
||||
==
|
||||
::
|
||||
[%9 axis=@ core=*]
|
||||
=/ core $(formula core.formula)
|
||||
?. ?=(%0 -.core) core
|
||||
=/ arm (frag axis.formula product.core)
|
||||
?~ arm [%2 trace]
|
||||
%= $
|
||||
subject product.core
|
||||
formula u.arm
|
||||
==
|
||||
::
|
||||
[%10 [axis=@ value=*] target=*]
|
||||
?: =(0 axis.formula) [%2 trace]
|
||||
=/ target $(formula target.formula)
|
||||
?. ?=(%0 -.target) target
|
||||
=/ value $(formula value.formula)
|
||||
?. ?=(%0 -.value) value
|
||||
=/ mutant=(unit *)
|
||||
(edit axis.formula product.target product.value)
|
||||
?~ mutant [%2 trace]
|
||||
[%0 u.mutant]
|
||||
::
|
||||
[%11 tag=@ next=*]
|
||||
%- tone
|
||||
.* .
|
||||
:+ 11 tag.formula
|
||||
!= $(formula next.formula)
|
||||
::
|
||||
[%11 [tag=@ clue=*] next=*]
|
||||
=/ clue $(formula clue.formula)
|
||||
?. ?=(%0 -.clue) clue
|
||||
%- tone
|
||||
.* .
|
||||
:+ 11 [tag.formula 1 product.clue]
|
||||
?. ?=(?(%hunk %hand %lose %mean %spot) tag.formula)
|
||||
!= $(formula next.formula)
|
||||
!= %= $
|
||||
formula next.formula
|
||||
trace :_ trace
|
||||
[tag.formula product.clue]
|
||||
==
|
||||
::
|
||||
[%12 ref=* path=*]
|
||||
=/ ref $(formula ref.formula)
|
||||
?. ?=(%0 -.ref) ref
|
||||
=/ path $(formula path.formula)
|
||||
?. ?=(%0 -.path) path
|
||||
=/ result (scry product.ref product.path)
|
||||
?~ result
|
||||
[%1 product.path]
|
||||
?~ u.result
|
||||
[%2 [%hunk (mush product.path)] trace]
|
||||
[%0 u.u.result]
|
||||
==
|
||||
::
|
||||
++ mush
|
||||
|= path=*
|
||||
^- tank
|
||||
:+ %rose ["/" "/" ""]
|
||||
=| out=(list tank)
|
||||
|- ^+ out
|
||||
?@ path
|
||||
?: =(0 path)
|
||||
(flop out)
|
||||
~
|
||||
?^ -.path ~
|
||||
%= $
|
||||
path +.path
|
||||
out :_ out
|
||||
leaf+(trip -.path)
|
||||
==
|
||||
::
|
||||
++ frag
|
||||
|= [axis=@ noun=*]
|
||||
^- (unit *)
|
||||
?: =(0 axis) ~
|
||||
|-
|
||||
?: =(1 axis)
|
||||
`noun
|
||||
?@ noun ~
|
||||
%= $
|
||||
axis (mas axis)
|
||||
noun ?: =(2 (cap axis))
|
||||
-.noun
|
||||
+.noun
|
||||
==
|
||||
::
|
||||
++ edit
|
||||
|= [axis=@ target=* value=*]
|
||||
^- (unit *)
|
||||
?: =(1 axis) `value
|
||||
?@ target ~
|
||||
=/ left=? =(2 (cap axis))
|
||||
=/ mutant
|
||||
%= $
|
||||
axis (mas axis)
|
||||
target ?:(left -.target +.target)
|
||||
==
|
||||
?~ mutant ~
|
||||
:- ~
|
||||
?: left
|
||||
[u.mutant +.target]
|
||||
[-.target u.mutant]
|
||||
--
|
||||
::
|
||||
++ mock
|
||||
|= {{sub/* fol/*} gul/$-({* *} (unit (unit)))}
|
||||
(mook (mink [sub fol] gul))
|
||||
::
|
||||
++ moku
|
||||
|= {{sub/* fol/*} gul/$-({* *} (unit (unit)))}
|
||||
(moko (mino [sub fol] gul))
|
||||
::
|
||||
++ mook
|
||||
|= ton/tone
|
||||
^- toon
|
||||
?. ?=({$2 *} ton) ton
|
||||
:- %2
|
||||
=+ yel=(lent trace.ton)
|
||||
=. trace.ton
|
||||
?. (gth yel 1.024) trace.ton
|
||||
%+ weld
|
||||
(scag 512 trace.ton)
|
||||
^- (list {@ta *})
|
||||
:_ (slag (sub yel 512) trace.ton)
|
||||
:- %lose
|
||||
%+ rap 3
|
||||
"[skipped {(scow %ud (sub yel 1.024))} frames]"
|
||||
|- ^- (list tank)
|
||||
?~ trace.ton ~
|
||||
=+ rep=$(trace.ton t.trace.ton)
|
||||
=* dat +.i.trace.ton
|
||||
?+ -.i.trace.ton rep
|
||||
$hunk =/ sof=(unit tank) ((soft tank) dat)
|
||||
?~ sof rep
|
||||
[u.sof rep]
|
||||
$lose ?^ dat rep
|
||||
:_ rep
|
||||
leaf+(rip 3 dat)
|
||||
$hand :_ rep
|
||||
leaf+(scow %p (mug +.i.trace.ton))
|
||||
$mean ?@ dat [leaf+(rip 3 dat) rep]
|
||||
=/ mac (mack dat -.dat)
|
||||
?~ mac [leaf+"####" rep]
|
||||
=/ sof ((soft tank) u.mac)
|
||||
?~ sof rep
|
||||
[u.sof rep]
|
||||
$spot =/ sof=(unit spot) ((soft spot) dat)
|
||||
?~ sof rep
|
||||
:_ rep
|
||||
:+ %rose [":" ~ ~]
|
||||
=* sot u.sof
|
||||
:~ (smyt p.sot)
|
||||
=> [ud=|=(a/@u (scow %ud a)) q.sot]
|
||||
leaf+"<[{(ud p.p)} {(ud q.p)}].[{(ud p.q)} {(ud q.q)}]>"
|
||||
== ==
|
||||
::
|
||||
++ moko
|
||||
|= ton/tono
|
||||
^- noot
|
||||
@ -6556,10 +6792,10 @@
|
||||
::
|
||||
++ mong
|
||||
|= {{gat/* sam/*} gul/$-({* *} (unit (unit)))}
|
||||
^- noot
|
||||
^- toon
|
||||
?. &(?=(^ gat) ?=(^ +.gat))
|
||||
[%2 ~]
|
||||
(moku [gat(+< sam) %9 2 %0 1] gul)
|
||||
(mock [gat(+< sam) %9 2 %0 1] gul)
|
||||
::
|
||||
++ mule :: typed virtual
|
||||
~/ %mule
|
||||
@ -6575,7 +6811,7 @@
|
||||
++ mute :: untyped virtual
|
||||
|= taq/_=>(~ ^?(|.(**)))
|
||||
^- (each * (list tank))
|
||||
=/ ton (moku [taq %9 2 %0 1] |=((pair) ``.*(~ [%12 1+p 1+q])))
|
||||
=/ ton (mock [taq %9 2 %0 1] |=((pair) ``.*(~ [%12 1+p 1+q])))
|
||||
?- -.ton
|
||||
$0 [%& p.ton]
|
||||
$1 [%| (smyt (path p.ton)) ~]
|
||||
|
@ -4752,7 +4752,7 @@
|
||||
(return-result u.cached-result)
|
||||
::
|
||||
=/ val
|
||||
(moku [q.subject-vase nock.u.slim-result] intercepted-scry)
|
||||
(mock [q.subject-vase nock.u.slim-result] intercepted-scry)
|
||||
:: val is a toon, which might be a list of blocks.
|
||||
::
|
||||
?- -.val
|
||||
|
@ -1355,7 +1355,7 @@
|
||||
++ ap-mule
|
||||
|= run=_^?(|.(*step:agent))
|
||||
^- (each step:agent tang)
|
||||
=/ res (moku [run %9 2 %0 1] (sloy ski))
|
||||
=/ res (mock [run %9 2 %0 1] (sloy ski))
|
||||
?- -.res
|
||||
%0 [%& !<(step:agent [-:!>(*step:agent) p.res])]
|
||||
%1 [%.n (smyt (path p.res)) ~]
|
||||
@ -1366,7 +1366,7 @@
|
||||
++ ap-mule-peek
|
||||
|= run=_^?(|.(*(unit (unit cage))))
|
||||
^- (each (unit (unit cage)) tang)
|
||||
=/ res (moku [run %9 2 %0 1] (sloy ski))
|
||||
=/ res (mock [run %9 2 %0 1] (sloy ski))
|
||||
?- -.res
|
||||
%0 [%& !<((unit (unit cage)) [-:!>(*(unit (unit cage))) p.res])]
|
||||
%1 [%.n (smyt (path p.res)) ~]
|
||||
|
@ -23,3 +23,24 @@
|
||||
return som;
|
||||
}
|
||||
}
|
||||
|
||||
u3_noun
|
||||
u3we_mink(u3_noun cor)
|
||||
{
|
||||
u3_noun bus, fol, gul;
|
||||
|
||||
if ( c3n == u3r_mean(cor, u3x_sam_4, &bus,
|
||||
u3x_sam_5, &fol,
|
||||
u3x_sam_3, &gul,
|
||||
0) )
|
||||
{
|
||||
return u3m_bail(c3__exit);
|
||||
}
|
||||
else {
|
||||
u3_noun som;
|
||||
|
||||
som = u3n_nock_et(u3k(gul), u3k(bus), u3k(fol));
|
||||
|
||||
return som;
|
||||
}
|
||||
}
|
||||
|
@ -848,6 +848,10 @@ static u3j_harm _141_qua_mino_a[] = {{".2", u3we_mino}, {}};
|
||||
static c3_c* _141_qua_mino_ha[] = {
|
||||
0
|
||||
};
|
||||
static u3j_harm _141_qua_mink_a[] = {{".2", u3we_mink}, {}};
|
||||
static c3_c* _141_qua_mink_ha[] = {
|
||||
0
|
||||
};
|
||||
static u3j_harm _141_qua_mule_a[] = {{".2", u3we_mule}, {}};
|
||||
static c3_c* _141_qua_mule_ha[] = {
|
||||
"d54688d726565ddade7f2636741cad7209ea40fab28d3335555d8a02ff6001c4",
|
||||
@ -881,6 +885,7 @@ static u3j_core _141_qua_d[] =
|
||||
{ "sfix", 7, _141_qua_sfix_a, 0, _141_qua_sfix_ha },
|
||||
|
||||
{ "mino", 7, _141_qua_mino_a, 0, _141_qua_mino_ha },
|
||||
{ "mink", 7, _141_qua_mino_a, 0, _141_qua_mink_ha },
|
||||
{ "mule", 7, _141_qua_mule_a, 0, _141_qua_mule_ha },
|
||||
{}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user