Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,50 @@
|
|||
( ( fixed {function to convert a rational number to fixed point notation.
|
||||
The second argument is the number of decimals. }
|
||||
= value decimals powerOf10
|
||||
. !arg:(?value.?decimals)
|
||||
& 10^!decimals:?powerOf10
|
||||
& str
|
||||
$ ( div$(!value.1)
|
||||
"."
|
||||
mod
|
||||
$ (div$(!value+1/2*!powerOf10^-1.!powerOf10^-1).!powerOf10)
|
||||
)
|
||||
)
|
||||
& (beef.38/10.36)
|
||||
(pork.54/10.43)
|
||||
(ham.36/10.90)
|
||||
(greaves.24/10.45)
|
||||
(flitch.40/10.30)
|
||||
(brawn.25/10.56)
|
||||
(welt.37/10.67)
|
||||
(salami.30/10.95)
|
||||
(sausage.59/10.98)
|
||||
: ?items
|
||||
& 0:?sorteditems
|
||||
& whl
|
||||
' ( !items:(?name.?mass.?price) ?items
|
||||
& (!mass*!price^-1.!mass.!name)+!sorteditems:?sorteditems
|
||||
)
|
||||
& 0:?totalMass
|
||||
& :?stolenItems
|
||||
& whl
|
||||
' ( !sorteditems:(?massPerPriceunit.?mass.?name)+?sorteditems
|
||||
& (!mass.!massPerPriceunit.!name) !stolenItems
|
||||
: ?stolenItems
|
||||
& !mass+!totalMass:?totalMass:~>15
|
||||
)
|
||||
& !stolenItems:(?mass.?massPerPriceunit.?name) ?stolenItems
|
||||
& 15+!mass+-1*!totalMass:?mass
|
||||
& (!mass.!massPerPriceunit.!name) !stolenItems:?stolenItems
|
||||
& 0:?totalPrice
|
||||
& ( !stolenItems
|
||||
: ?
|
||||
( (?mass.?massPerPriceunit.?name)
|
||||
& out$(fixed$(!mass.1) "kg of" !name)
|
||||
& !mass*!massPerPriceunit^-1+!totalPrice:?totalPrice
|
||||
& ~
|
||||
)
|
||||
?
|
||||
| out$(fixed$(!totalPrice.2))
|
||||
)
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue