wrote and tested +unify-jugs. not used in ford yet

This commit is contained in:
Ted Blackman 2018-03-20 10:30:39 -07:00
parent be568ca88e
commit 9d4a6cf534
2 changed files with 34 additions and 4 deletions

View File

@ -10,6 +10,7 @@
^- wall
;: weld
test-compiles
test-unify-jugs
test-literal
test-autocons-same
test-autocons-different
@ -19,6 +20,15 @@
%- expect-eq !>
[ford-turbo ford-turbo]
::
++ test-unify-jugs
~& %test-unify-jugs
%- expect-eq !>
:- %+ unify-jugs:ford
`(jug @tas @ud)`(my ~[[%a (sy 1 2 ~)] [%b (sy 3 4 ~)]])
`(jug @tas @ud)`(my ~[[%b (sy 5 6 ~)] [%c (sy 7 8 ~)]])
::
`(jug @tas @ud)`(my ~[[%a (sy 1 2 ~)] [%b (sy 3 4 5 6 ~)] [%c (sy 7 8 ~)]])
::
++ test-literal
~& %test-literal
=^ moves ford

View File

@ -826,6 +826,29 @@
::
[%dependency =dependency]
==
--
|%
:: +unify-jugs: make a new jug, unifying sets for all keys
::
++ unify-jugs
|* [a=(jug) b=(jug)]
^+ a
::
=/ tapped ~(tap by b)
::
|- ^+ a
?~ tapped a
::
=/ key p.i.tapped
=/ vals ~(tap in q.i.tapped)
::
=. a
|- ^+ a
?~ vals a
::
$(vals t.vals, a (~(put ju a) key i.vals))
::
$(tapped t.tapped)
:: +by-schematic: door for manipulating :builds-by-schematic.ford-state
::
++ by-schematic
@ -862,8 +885,6 @@
::
builds
--
--
|%
:: +ev: per-event core
::
++ ev
@ -954,8 +975,7 @@
|= [=block that=_this]
?- -.block
%build
=. that (execute:that build.block live)
that
(execute:that build.block live)
::
%dependency
!!