mirror of
https://github.com/urbit/shrub.git
synced 2024-12-21 01:41:37 +03:00
hoon: refactors +edit and +frag in +mink
This commit is contained in:
parent
56418b7ad7
commit
5141dc4de9
@ -6451,35 +6451,33 @@
|
||||
::
|
||||
++ frag
|
||||
|= [axis=@ noun=*]
|
||||
^- (unit *)
|
||||
^- (unit)
|
||||
?: =(0 axis) ~
|
||||
|-
|
||||
?: =(1 axis)
|
||||
`noun
|
||||
|- ^- (unit)
|
||||
?: =(1 axis) `noun
|
||||
?@ noun ~
|
||||
=/ pick (cap axis)
|
||||
%= $
|
||||
axis (mas axis)
|
||||
noun ?: =(2 (cap axis))
|
||||
-.noun
|
||||
+.noun
|
||||
noun ?-(pick %2 -.noun, %3 +.noun)
|
||||
==
|
||||
::
|
||||
++ edit
|
||||
|= [axis=@ target=* value=*]
|
||||
^- (unit *)
|
||||
^- (unit)
|
||||
?: =(1 axis) `value
|
||||
?@ target ~
|
||||
=/ left=? =(2 (cap axis))
|
||||
=/ pick (cap axis)
|
||||
=/ mutant
|
||||
%= $
|
||||
axis (mas axis)
|
||||
target ?:(left -.target +.target)
|
||||
target ?-(pick %2 -.target, %3 +.target)
|
||||
==
|
||||
?~ mutant ~
|
||||
:- ~
|
||||
?: left
|
||||
[u.mutant +.target]
|
||||
[-.target u.mutant]
|
||||
?- pick
|
||||
%2 `[u.mutant +.target]
|
||||
%3 `[-.target u.mutant]
|
||||
==
|
||||
--
|
||||
::
|
||||
++ mock
|
||||
|
Loading…
Reference in New Issue
Block a user