Modify for all-wet core.
:: :: ::
:::: :: ::
:: :: ::
+!:
|%
++ foil :: ship allocation map
|* a=mold :: entry mold
[min=1 ctr=1 und=~ ove=~ max=(dec (bex (bex a))) box=~]
::
++ fo
- =| (foil $@(~ *))
- |@
+ |_ (foil $@(~ *))
+- nth :: index
|= a/@u ^- (pair (unit @u) @u)
?: (lth a ~(wyt in und))
?: =(0 a) [(some ctr) a]
$(a (dec a), +<.nth new)
::
+ +- fit |=(a/@u &((lte min a) (lte a max))) :: in range
+ +- gud :: invariant
+ ?& (fit(max +(max)) ctr)
+ (~(all in und) fit(max ctr))
+ (~(all in ove) fit(min ctr))
+ (~(all in box) |=({a/@u *} (fit a)))
+ |- ^- ?
+ ?: =(min max) &
+ =- &(- $(min +(min)))
+ %+ gte 1 :: at most one of
+ ;: add
+ ?:(=(min ctr) 1 0)
+ ?:((~(has in und) min) 1 0)
+ ?:((~(has in ove) min) 1 0)
+ ?:((~(has by box) min) 1 0)
+ ==
+ ==
+ ::
+- fin +< :: abet
- +- new :: alloc
- ?: =(ctr +(max)) +<
- =. ctr +(ctr)
- ?. (~(has in ove) ctr) +<
- new(ove (~(del in ove) ctr))
::
+- get :: nullable
|= a/@p ^+ ?~(box ~ q.n.box)
+- put
|* {a/@u b/*} ^+ fin :: b/_(~(got by box))
~| put+[a fin]
- ?> (fit a)
+ :: ?> (fit a)
=; adj adj(box (~(put by box) a b))
?: (~(has in box) a) fin
?: =(ctr a) new
=+ n=new(+< new)
n(und (~(put in und.n) ctr))
::
- +- fit |=(a/@u &((lte min a) (lte a max))) :: in range
- +- gud :: invariant
- ?& (fit(max +(max)) ctr)
- (~(all in und) fit(max ctr))
- (~(all in ove) fit(min ctr))
- (~(all in box) |=({a/@u *} (fit a)))
- |- ^- ?
- ?: =(min max) &
- =- &(- $(min +(min)))
- %+ gte 1 :: at most one of
- ;: add
- ?:(=(min ctr) 1 0)
- ?:((~(has in und) min) 1 0)
- ?:((~(has in ove) min) 1 0)
- ?:((~(has by box) min) 1 0)
- ==
- ==
+ +- new :: alloc
+ |- ^+ +>-
+ ?: =(ctr +(max)) +>-
+ =. ctr +(ctr)
+ ?. (~(has in ove) ctr) +>-
+ $(ove (~(del in ove) ctr))
--
--
:: :: ::
